From acd36007a67d84ff4b92b830ef9e9452b3a69f34 Mon Sep 17 00:00:00 2001 From: danylo-safonov-solid Date: Thu, 21 Sep 2023 22:26:06 +0300 Subject: [PATCH] upd again --- example/lib/main.dart | 1 + lib/deno_postgres_interop.dart | 1 + lib/src/errors/connection_error.dart | 7 +++++++ lib/src/errors/connection_params_error.dart | 7 +++++++ lib/src/errors/postgres_error.dart | 7 ++++++- 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 lib/src/errors/connection_error.dart create mode 100644 lib/src/errors/connection_params_error.dart diff --git a/example/lib/main.dart b/example/lib/main.dart index 5fc9218..31702b3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -43,6 +43,7 @@ ${e.cause} ${e.cause.name} ${e.cause.cause} ${e.cause.message} + ${e.cause.fields} ${e.message} $e '''); diff --git a/lib/deno_postgres_interop.dart b/lib/deno_postgres_interop.dart index 504ee77..11b5086 100644 --- a/lib/deno_postgres_interop.dart +++ b/lib/deno_postgres_interop.dart @@ -9,6 +9,7 @@ export 'src/command_type.dart'; export 'src/connection.dart'; export 'src/connection_options.dart'; export 'src/encoded_arg.dart'; +export 'src/errors/postgres_error.dart'; export 'src/errors/transaction_error.dart'; export 'src/isolation_level.dart'; export 'src/notice.dart'; diff --git a/lib/src/errors/connection_error.dart b/lib/src/errors/connection_error.dart new file mode 100644 index 0000000..1f3e6cc --- /dev/null +++ b/lib/src/errors/connection_error.dart @@ -0,0 +1,7 @@ +import 'dart:js_interop'; + +import 'package:deno_postgres_interop/src/errors/js_error.dart'; + +/// [js/Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error). +@JS('Error') +class ConnectionError extends JSError {} diff --git a/lib/src/errors/connection_params_error.dart b/lib/src/errors/connection_params_error.dart new file mode 100644 index 0000000..f8b66c2 --- /dev/null +++ b/lib/src/errors/connection_params_error.dart @@ -0,0 +1,7 @@ +import 'dart:js_interop'; + +import 'package:deno_postgres_interop/src/errors/js_error.dart'; + +/// [js/Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error). +@JS('Error') +class ConnectionParamsError extends JSError {} diff --git a/lib/src/errors/postgres_error.dart b/lib/src/errors/postgres_error.dart index 3af19e6..5ebd9a1 100644 --- a/lib/src/errors/postgres_error.dart +++ b/lib/src/errors/postgres_error.dart @@ -1,6 +1,11 @@ import 'dart:js_interop'; import 'package:deno_postgres_interop/src/errors/js_error.dart'; +import 'package:deno_postgres_interop/src/notice.dart'; +/// [deno-postgres@v0.17.0/PostgresError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=TransactionError). @JS() -class PostgresError extends JSError {} +class PostgresError extends JSError { + /// [deno-postgres@v0.17.0/PostgresError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=PostgresError#prop_fields). + external Notice get fields; +}