EdgeAIG's picture
download
raw
12.9 kB
import * as Schema from "../../Schema.ts";
declare const TypeId: "~effect/sql/SqlError";
declare const ReasonTypeId: "~effect/sql/SqlError/Reason";
declare const ConnectionError_base: Schema.Class<ConnectionError, Schema.TaggedStruct<"ConnectionError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for connection or open failures; marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class ConnectionError extends ConnectionError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const AuthenticationError_base: Schema.Class<AuthenticationError, Schema.TaggedStruct<"AuthenticationError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for authentication failures such as invalid credentials; not
* marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class AuthenticationError extends AuthenticationError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const AuthorizationError_base: Schema.Class<AuthorizationError, Schema.TaggedStruct<"AuthorizationError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for authorization or permission failures; not marked
* retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class AuthorizationError extends AuthorizationError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const SqlSyntaxError_base: Schema.Class<SqlSyntaxError, Schema.TaggedStruct<"SqlSyntaxError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for invalid SQL syntax; not marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class SqlSyntaxError extends SqlSyntaxError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const UniqueViolation_base: Schema.Class<UniqueViolation, Schema.TaggedStruct<"UniqueViolation", {
constraint: Schema.String;
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for a unique constraint violation, including the violated
* constraint identifier; not marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class UniqueViolation extends UniqueViolation_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const ConstraintError_base: Schema.Class<ConstraintError, Schema.TaggedStruct<"ConstraintError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for a non-unique constraint violation; not marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class ConstraintError extends ConstraintError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const DeadlockError_base: Schema.Class<DeadlockError, Schema.TaggedStruct<"DeadlockError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for a database deadlock; marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class DeadlockError extends DeadlockError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const SerializationError_base: Schema.Class<SerializationError, Schema.TaggedStruct<"SerializationError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for a transaction serialization or isolation conflict;
* marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class SerializationError extends SerializationError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const LockTimeoutError_base: Schema.Class<LockTimeoutError, Schema.TaggedStruct<"LockTimeoutError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for timing out while waiting on a database lock; marked
* retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class LockTimeoutError extends LockTimeoutError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const StatementTimeoutError_base: Schema.Class<StatementTimeoutError, Schema.TaggedStruct<"StatementTimeoutError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for a statement or query timeout; marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class StatementTimeoutError extends StatementTimeoutError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
declare const UnknownError_base: Schema.Class<UnknownError, Schema.TaggedStruct<"UnknownError", {
cause: Schema.Defect;
message: Schema.optional<Schema.String>;
operation: Schema.optional<Schema.String>;
}>, import("../../Cause.ts").YieldableError>;
/**
* SQL error reason for an unclassified database failure; not marked retryable.
*
* @category errors
* @since 4.0.0
*/
export declare class UnknownError extends UnknownError_base {
/**
* Marks this value as a structured SQL error reason for runtime guards.
*
* @since 4.0.0
*/
readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
/**
* Indicates whether retrying the failed SQL operation may succeed.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
/**
* Union of structured SQL error reasons, each carrying the original cause plus
* optional message and operation metadata.
*
* @category errors
* @since 4.0.0
*/
export type SqlErrorReason = ConnectionError | AuthenticationError | AuthorizationError | SqlSyntaxError | UniqueViolation | ConstraintError | DeadlockError | SerializationError | LockTimeoutError | StatementTimeoutError | UnknownError;
/**
* Schema for encoding and decoding SQL error reasons.
*
* @category schemas
* @since 4.0.0
*/
export declare const SqlErrorReason: Schema.Union<[
typeof ConnectionError,
typeof AuthenticationError,
typeof AuthorizationError,
typeof SqlSyntaxError,
typeof UniqueViolation,
typeof ConstraintError,
typeof DeadlockError,
typeof SerializationError,
typeof LockTimeoutError,
typeof StatementTimeoutError,
typeof UnknownError
]>;
declare const SqlError_base: Schema.Class<SqlError, Schema.TaggedStruct<"SqlError", {
readonly reason: Schema.Union<[typeof ConnectionError, typeof AuthenticationError, typeof AuthorizationError, typeof SqlSyntaxError, typeof UniqueViolation, typeof ConstraintError, typeof DeadlockError, typeof SerializationError, typeof LockTimeoutError, typeof StatementTimeoutError, typeof UnknownError]>;
}>, import("../../Cause.ts").YieldableError>;
/**
* Error wrapper for SQL failures whose `message`, `cause`, and `isRetryable`
* values are derived from its `SqlErrorReason`.
*
* @category errors
* @since 4.0.0
*/
export declare class SqlError extends SqlError_base {
/**
* Marks this value as the top-level SQL error wrapper for runtime guards.
*
* @since 4.0.0
*/
readonly [TypeId]: "~effect/sql/SqlError";
/**
* Exposes the structured SQL reason as the JavaScript error cause.
*
* @since 4.0.0
*/
readonly cause: ConnectionError | AuthenticationError | AuthorizationError | SqlSyntaxError | UniqueViolation | ConstraintError | DeadlockError | SerializationError | LockTimeoutError | StatementTimeoutError | UnknownError;
/**
* Uses the reason message when present, otherwise falls back to the reason tag.
*
* @since 4.0.0
*/
get message(): string;
/**
* Delegates retryability to the underlying SQL error reason.
*
* @since 4.0.0
*/
get isRetryable(): boolean;
}
/**
* Returns `true` when a value is a `SqlError`.
*
* @category guards
* @since 4.0.0
*/
export declare const isSqlError: (u: unknown) => u is SqlError;
/**
* Returns `true` when a value is a `SqlErrorReason`.
*
* @category guards
* @since 4.0.0
*/
export declare const isSqlErrorReason: (u: unknown) => u is SqlErrorReason;
type SqliteClassifyOptions = {
readonly message?: string | undefined;
readonly operation?: string | undefined;
};
/**
* Classifies a native SQLite error cause into a `SqlErrorReason` using its
* `code` or `errno`, with optional message and operation metadata.
*
* @category converting
* @since 4.0.0
*/
export declare const classifySqliteError: (cause: unknown, { message, operation }?: SqliteClassifyOptions) => SqlErrorReason;
declare const ResultLengthMismatch_base: Schema.Class<ResultLengthMismatch, Schema.TaggedStruct<"ResultLengthMismatch", {
readonly expected: Schema.Number;
readonly actual: Schema.Number;
}>, import("../../Cause.ts").YieldableError>;
/**
* Error raised when an ordered batched SQL resolver receives a different number
* of result rows than requests.
*
* @category errors
* @since 4.0.0
*/
export declare class ResultLengthMismatch extends ResultLengthMismatch_base {
/**
* Explains the mismatch between expected and actual batched SQL result counts.
*
* @since 4.0.0
*/
get message(): string;
}
export {};
//# sourceMappingURL=SqlError.d.ts.map

Xet Storage Details

Size:
12.9 kB
·
Xet hash:
071b38d5525a762a315a6b74e414f12bcefbda802669df23978e77dc054a23ca

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.