All files / src/common errors.js

100% Statements 10/10
100% Branches 0/0
100% Functions 6/6
100% Lines 10/10
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        6x 6x           1x           1x           1x           2x 2x 2x           1x       5x              
'use strict';
 
class BaseError extends Error {
    constructor(message) {
        super(message);
        this.name = this.constructor.name;
    }
}
 
class NoServerlessConfigFoundError extends BaseError {
    constructor() {
        super('No serverless config found');
    }
}
 
class CantFindService extends BaseError {
    constructor(query) {
        super(`Could not find service matching query "${query}"`);
    }
}
 
class ServerlessExecutableNotFoundError extends BaseError {
    constructor() {
        super('Could not find serverless executable');
    }
}
 
class ServerlessCommandError extends BaseError {
    constructor(code, log, errorLog) {
        super(`Serverless exited with code ${code}`);
        this.log = log;
        this.errorLog = errorLog;
    }
}
 
class CanNotRollback extends BaseError {
    constructor() {
        super('Can not rollback service without previous versions');
    }
}
 
module.exports = {
    NoServerlessConfigFoundError,
    CantFindService,
    CanNotRollback,
    ServerlessExecutableNotFoundError,
    ServerlessCommandError
};