All files graph-error.ts

50% Statements 6/12
100% Branches 2/2
25% Functions 1/4
50% Lines 6/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31      1x 1x 1x     1x                 1x             1x            
// tslint:disable: max-classes-per-file
import { ShortChannelId } from "@node-lightning/core";
 
export enum GraphErrorCode {
    ChannelNotFound = 1,
    NodeNotFound = 2,
}
 
export abstract class GraphError extends Error {
    public code: GraphErrorCode;
 
    constructor(code: GraphErrorCode, message: string) {
        super(message);
        this.code = code;
    }
}
 
export class ChannelNotFoundError extends GraphError {
    constructor(scid: ShortChannelId) {
        const msg = `channel_not_found ${scid.toString()}`;
        super(GraphErrorCode.ChannelNotFound, msg);
    }
}
 
export class NodeNotFoundError extends GraphError {
    constructor(nodeId: Buffer) {
        const msg = `node_not_found ${nodeId.toString()}`;
        super(GraphErrorCode.NodeNotFound, msg);
    }
}