Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-safonov-solid committed Sep 21, 2023
1 parent 789adf6 commit c2f98cb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ ${result.rowDescription?.columns.map((e) => ' name = ${e.name}').join('\n')}
...result.rows.map(rowToPrettyString),
].join('\n\n'),
);
} on JSError catch (e) {
} on TransactionError catch (e) {
await client.end();

return Response('''
${e.name}
${e.cause}
${e.cause.name}
${e.cause.cause}
${e.cause.message}
${e.message}
$e
''');
Expand Down
1 change: 1 addition & 0 deletions lib/deno_postgres_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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/transaction_error.dart';
export 'src/isolation_level.dart';
export 'src/notice.dart';
export 'src/partial/partial_connection_options.dart';
Expand Down
6 changes: 6 additions & 0 deletions lib/src/errors/postgres_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/js_error.dart';

@JS()
class PostgresError extends JSError {}

Check notice on line 6 in lib/src/errors/postgres_error.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.
17 changes: 17 additions & 0 deletions lib/src/errors/transaction_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/js_error.dart';

Check warning on line 3 in lib/src/errors/transaction_error.dart

View workflow job for this annotation

GitHub Actions / build

Unused import: 'package:deno_postgres_interop/src/errors/js_error.dart'.

Try removing the import directive. See https://dart.dev/diagnostics/unused_import to learn more about this problem.
import 'package:deno_postgres_interop/src/errors/postgres_error.dart';

/// [deno-postgres@v0.17.0/TransactionError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=TransactionError).
@JS()
class TransactionError {
/// [js/Error/cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause).
external PostgresError get cause;

/// [js/Error/message](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message).
external String get message;

/// [js/Error/name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name).
external String get name;
}

0 comments on commit c2f98cb

Please sign in to comment.