import { format as format } from 'util'; import CustomError from '../custom-error'; const errorList = require('../../../i18n').errors; export class CoError extends CustomError { constructor (code: string | number, ...restArgs: string[]) { const message = errorList[code] || code; super(code, message); if (restArgs.length) { this.message = format(message, ...restArgs); } } }