import { Exception } from "./Exception"; export enum MockExceptionReason { NoSetup = "no setup expression found for", MoreThanOneSetup = "more than one setup expression found for", InvalidArg = "invalid argument", InvalidSetup = "invalid setup expression", InvalidMatcher = "invalid matching expression", UnknownGlobalType = "unknown global type", CallCountVerificationFailed = "invocation count verification failed", CallOrderVerificationFailed = "invocation order verification failed", InvalidDynamicProxyRuntime = "invalid dynamic proxy runtime" } export class MockException extends Exception { constructor( public readonly reason: MockExceptionReason, public readonly ctx: any, public readonly message: string = undefined) { super("MockException", message); Object.setPrototypeOf(this, MockException.prototype); } toString(): string { let errMsg = `${this.name} - ${this.reason}`; if (this.message) errMsg = `${errMsg} (${this.message})`; return errMsg; } }