All files / zyspawn error.js

92.86% Statements 13/14
100% Branches 0/0
83.33% Functions 5/6
92.86% Lines 13/14

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 786x             19x 19x                 9x                         3x                         3x                                           4x           6x 6x 6x 6x 6x 6x  
const util = require('util')
 
/**
 * All errors happening inside zyspawn
 */
class ZyspawnError extends Error {
    constructor(message) {
        super(message);
        this.name = 'ZyspawnError';
    }
}
 
/**
 * Errors due to problems of implementation.
 */
class InternalZyspawnError extends ZyspawnError {
    constructor(message) {
        super("Internal error: " + message);
    }
}
 
/**
 * Error when function is missing. Occurs in
 *      ZygoteInterface.call()
 */
class FunctionMissingError extends ZyspawnError {
    /**
     * @param {string} message the message correlated with the missing function
     */
    constructor(funcname, filename) {
        super("Missing function \"" + funcname + "\" in file \"" + filename + "\"");
    }
}
 
/**
 * Error when file is missing. Occurs in
 *      ZygoteInterface.call()
 */
class FileMissingError extends ZyspawnError {
    /**
     * @param {string} message the message correlated with the missing function
     */
    constructor(filename) {
        super("Missing file " + filename);
    }
}
 
/**
 * Error when a method is called in a wrong state. Occurs in
 *      ZygoteInterface.call()
 *      // TODO ...
 */
class InvalidOperationError extends ZyspawnError {
    constructor(issue) {
        super("Invald operation: " + issue);
    }
}
 
/**
 * Error when a method is timesout
 *      ZygoteInterface.call()
 *      // TODO ...
 */
class TimeoutError extends ZyspawnError {
    constructor(timeoutDesc) {
        super("Timeout on: " + timeoutDesc);
    }
}
 
 
// const {ZyspawnError, InternalZyspawnError, FileMissingError, FunctionMissingError, InvalidOperationError, TimeoutError}
module.exports.ZyspawnError = ZyspawnError;
module.exports.InternalZyspawnError = InternalZyspawnError;
module.exports.FileMissingError = FileMissingError;
module.exports.FunctionMissingError = FunctionMissingError;
module.exports.InvalidOperationError = InvalidOperationError;
module.exports.TimeoutError = TimeoutError;