-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {InvalidOperationException} from './InvalidOperationException'; | ||
|
||
/** | ||
* Exception that will be thrown if an operation is invalid because the object is already disposed. | ||
*/ | ||
export class ObjectDisposedException extends InvalidOperationException { | ||
private readonly _objectName: symbol; | ||
|
||
public constructor(objectName: string, cause?: Error); | ||
public constructor(objectName: string, message?: string, cause?: Error); | ||
public constructor(objectName: string, messageOrCause?: string | Error, cause?: Error) { | ||
super( | ||
typeof messageOrCause === 'string' ? | ||
messageOrCause : | ||
'Cannot access a disposed object.', | ||
typeof messageOrCause === 'string' || cause ? | ||
cause : | ||
messageOrCause | ||
); | ||
this._objectName = Symbol('Object name'); | ||
this.data[this._objectName] = objectName; | ||
} | ||
|
||
public get objectName(): string { | ||
return this.data[this._objectName]; | ||
} | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.