Skip to content

Commit 255d722

Browse files
committedJun 18, 2024
refactoring
1 parent 183b36a commit 255d722

11 files changed

+3469
-3570
lines changed
 

‎apps/tutorial/application.js

+3,441-3,460
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/tutorial/application.js.map

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/tutorial/serviceworker.js

+5-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/tutorial/serviceworker.js.map

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/common/src/detailed-error.ts

-50
This file was deleted.

‎packages/common/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * from './angle-parser'
22
export * from './complex'
33
export * from './config'
4-
export * from './detailed-error'
54
export * from './emit-event'
65
export * from './format'
76
export * from './number-formatter'

‎packages/elements/src/angle-slider-element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {DetailedError, Util, angleDenominator, radian as radianOf} from '@qni/common'
1+
import {Util, angleDenominator, radian as radianOf} from '@qni/common'
22
import {attr, controller} from '@github/catalyst'
33
import {createMachine, interpret} from 'xstate'
44
import {html, render} from '@github/jtml'
@@ -65,7 +65,7 @@ export class AngleSliderElement extends HTMLElement {
6565
actions: {
6666
validateDenominator: () => {
6767
if (!Number.isInteger(this.denominator) || this.denominator <= 0) {
68-
throw new DetailedError('Bad denominator', this.denominator)
68+
throw new Error(`Bad denominator: ${this.denominator}`)
6969
}
7070
},
7171
setDenominatorByAngle: (_context, event) => {

‎packages/elements/src/circle-notation-element.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Complex, DetailedError, Util} from '@qni/common'
1+
import {Complex, Util} from '@qni/common'
22
import {attr, controller, target, targets} from '@github/catalyst'
33
import {html, render} from '@github/jtml'
44
import tippy, {Instance, ReferenceElement} from 'tippy.js'
@@ -198,7 +198,7 @@ export class CircleNotationElement extends HTMLElement {
198198
break
199199
}
200200
default:
201-
throw new DetailedError('unsupported qubit count', this.qubitCount)
201+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
202202
}
203203
}
204204

@@ -307,7 +307,7 @@ export class CircleNotationElement extends HTMLElement {
307307
break
308308
}
309309
default:
310-
throw new DetailedError('unsupported qubit count', this.qubitCount)
310+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
311311
}
312312
}
313313

@@ -575,7 +575,7 @@ export class CircleNotationElement extends HTMLElement {
575575
}
576576
}
577577
default:
578-
throw new DetailedError('unsupported qubit count', this.qubitCount)
578+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
579579
}
580580
}
581581

@@ -646,7 +646,7 @@ export class CircleNotationElement extends HTMLElement {
646646
return this.qubitCircleSizePx * 32 + this.gap * 31
647647
}
648648
default:
649-
throw new DetailedError('unsupported qubit count', this.qubitCount)
649+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
650650
}
651651
}
652652

@@ -773,7 +773,7 @@ export class CircleNotationElement extends HTMLElement {
773773
return 16
774774
}
775775
default:
776-
throw new DetailedError('unsupported qubit count', this.qubitCount)
776+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
777777
}
778778
}
779779

@@ -1011,7 +1011,7 @@ export class CircleNotationElement extends HTMLElement {
10111011
return 1
10121012
}
10131013
default:
1014-
throw new DetailedError('unsupported qubit count', this.qubitCount)
1014+
throw new Error(`unsupported qubit count: ${this.qubitCount}`)
10151015
}
10161016
}
10171017

‎packages/elements/src/circuit-editor-element.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Angleable, Flaggable, Ifable, isAngleable, isDraggable, isIfable, isMenuable, isResizeable} from './mixin'
22
import {CircuitStepElement, isCircuitStepElement} from './circuit-step-element'
3-
import {Config, DetailedError, Util, isResizeableSpan} from '@qni/common'
3+
import {Config, Util, isResizeableSpan} from '@qni/common'
44
import {Operation, isOperation} from './operation'
55
import {attr, controller, target} from '@github/catalyst'
66
import {createMachine, interpret} from 'xstate'
@@ -435,7 +435,7 @@ export class CircuitEditorElement extends HTMLElement {
435435
if (isDraggable(el)) {
436436
el.draggable = true
437437
} else {
438-
throw new DetailedError('Not a draggable element.', {el})
438+
throw new Error(`Not a draggable element: ${el}`)
439439
}
440440
}
441441

@@ -445,7 +445,7 @@ export class CircuitEditorElement extends HTMLElement {
445445
if (isResizeable(el)) {
446446
el.resizeable = true
447447
} else {
448-
throw new DetailedError('Not a resizeable element.', {el})
448+
throw new Error(`Not a resizeable element: ${el}`)
449449
}
450450
}
451451

‎packages/elements/src/circuit-step-element.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Config,
3-
DetailedError,
43
ResizeableSpan,
54
SerializedCircuitStep,
65
SerializedHGate,
@@ -1341,7 +1340,7 @@ export class CircuitStepElement extends HTMLElement {
13411340
break
13421341
}
13431342
default:
1344-
throw new DetailedError('Unrecognized operation', {klass})
1343+
throw new Error(`Unrecognized operation: ${klass}`)
13451344
}
13461345
}
13471346
return serializedStep

‎packages/elements/src/quantum-simulator-element.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Complex, DetailedError, Util} from '@qni/common'
1+
import {Complex, Util} from '@qni/common'
22
import {attr, controller, target, targets} from '@github/catalyst'
33
import {html, render} from '@github/jtml'
44
import {isBlochDisplayElement, isMeasurementGateElement} from './operation'
@@ -130,7 +130,7 @@ export class QuantumSimulatorElement extends HTMLElement {
130130
break
131131
}
132132
default:
133-
throw new DetailedError('Unknown service worker message', {data})
133+
throw new Error(`Unknown service worker message: ${data}`)
134134
}
135135
}
136136

0 commit comments

Comments
 (0)
Failed to load comments.