//·························································· // Copyright (c) 2023-2026. Jonathan Bédard ~ JóôòKiwi // // This project is free to use. // All the right is reserved to the author of this project. // My projects: // - https://github.com/joooKiwi/type // - https://github.com/joooKiwi/lazy // - https://github.com/joooKiwi/collection // - https://github.com/joooKiwi/enumeration //·························································· import type {Nullable, NullOr} from "@joookiwi/type" import type {ExceptionWithNullableCause} from "./declaration/ExceptionWithNullableCause" /** * An instance was received as `null` value * * @see https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/NullPointerException.html Java NullPointerException * @see https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception Kotlin NullPointerException * @see https://learn.microsoft.com/dotnet/api/system.nullreferenceexception C# NullReferenceException */ export class NullInstanceException extends TypeError implements ExceptionWithNullableCause { public override readonly name = this.constructor.name readonly #cause: NullOr public constructor(cause?: Nullable,) { super("The instance received cannot be null.",) this.#cause = cause ?? null } public override get cause(): NullOr { return this.#cause } }