time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

SqError.js (1554B)


      1 class SqAbstractError {
      2 }
      3 export class SqFrame {
      4     constructor(_value) {
      5         this._value = _value;
      6     }
      7     name() {
      8         return this._value.name;
      9     }
     10     location() {
     11         return this._value.location;
     12     }
     13 }
     14 export class SqRuntimeError extends SqAbstractError {
     15     constructor(_value) {
     16         super();
     17         this._value = _value;
     18         this.tag = "runtime";
     19     }
     20     toString() {
     21         return this._value.toString();
     22     }
     23     toStringWithDetails() {
     24         return this._value.toStringWithDetails();
     25     }
     26     getTopFrame() {
     27         const frame = this._value.getTopFrame();
     28         return frame ? new SqFrame(frame) : undefined;
     29     }
     30     getFrameArray() {
     31         const frames = this._value.getFrameArray();
     32         return frames.map((frame) => new SqFrame(frame));
     33     }
     34     location() {
     35         return this.getTopFrame()?.location();
     36     }
     37 }
     38 export class SqCompileError extends SqAbstractError {
     39     constructor(_value) {
     40         super();
     41         this._value = _value;
     42         this.tag = "compile";
     43     }
     44     toString() {
     45         return this._value.toString();
     46     }
     47     toStringWithDetails() {
     48         return this._value.toStringWithDetails();
     49     }
     50     location() {
     51         return this._value.location;
     52     }
     53 }
     54 export class SqOtherError extends SqAbstractError {
     55     constructor(_value) {
     56         super();
     57         this._value = _value;
     58         this.tag = "other";
     59     }
     60     toString() {
     61         return this._value;
     62     }
     63     toStringWithDetails() {
     64         return this._value;
     65     }
     66 }
     67 //# sourceMappingURL=SqError.js.map