34 Commits

Author SHA1 Message Date
Chris Tsang
b3e4d1c1cf RecordNotFound -> RecordNotUpdated 2023-01-25 15:43:44 +08:00
Chris Tsang
03207fbda9 Use rows_affected when DB does not support returning 2023-01-18 21:18:04 +08:00
Billy Chan
b5e984ca4a
Postgres insert many will throw RecordNotInserted error if non of them are being inserted (#1021) 2023-01-11 14:16:35 +08:00
e-rhodes
69612fa507
Fix typo in error name (#1180)
* fix typo in error name

* fixed typo in docs

Co-authored-by: erhodes <erik@space-nav.com>
2022-11-06 14:18:07 +08:00
Billy Chan
a766500ebf
Cont. "Enable convert from ActiveModel to Model" (#990)
* Changelog

* Enable convert from ActiveModel to Model (#725)

* feat: enable convert from ActiveModel to Model

* feat: add tests for converting from ActiveModel to Model

* cargo fmt

* Refactoring

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

* Fix clippy warnings

* Use error type

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
Co-authored-by: greenhandatsjtu <40566803+greenhandatsjtu@users.noreply.github.com>
2022-10-23 23:12:22 +08:00
Chris Tsang
a44017f679 Reorder variants 2022-10-07 00:15:36 +08:00
Chris Tsang
1225255431 Address comments 2022-09-14 00:28:24 +08:00
Chris Tsang
36f09c524e
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:45:17 +08:00
Chris Tsang
4993c6ab2d
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:45:09 +08:00
Chris Tsang
4d95218430
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:44:59 +08:00
Chris Tsang
1c8ef33544
Update src/error.rs
Co-authored-by: Sculas <contact@sculas.xyz>
2022-09-03 20:44:45 +08:00
Chris Tsang
85533a3bb3 Give up and fix tests 2022-08-28 14:54:26 +08:00
Chris Tsang
0ce0f49551 Refactor SqlxError; 2022-08-28 13:51:21 +08:00
Chris Tsang
348e841139 Refactor ColumnFromStrErr 2022-08-28 13:30:51 +08:00
Chris Tsang
0b754eab0b Refactor Type Errors 2022-08-28 12:59:33 +08:00
mohs8421
fe6c40dd75
Introducing sqlx-error feature (#750)
* feat: Introducing feature "sqlx-error"

Purpose of this feature is to not convert errors given from sqlx into strings to ease further analysis of the error and react to it accordingly. This implementation uses a feature switch and an additional error kind to avoid interfering with existing implementations without this feature enabled.
See discussion https://github.com/SeaQL/sea-orm/discussions/709

* fix: Align feature "sqlx-error" with merged Migration error kind

Due to the merge, an other error kind had been introduced and the DbErr became Eq and Clone, however Eq cannot easily be derived from, so I went back to PartialEq, and since the sqlx error does not implement clone, this was converted into an Arc, to allow cloning of the new kind too.

* fix: Repairing failing jobs

Several jobs had failed as I missed to correct the return values of a few methods in transaction.rs and had a wrong understanding of map_err at that point.

* feat: realigning with latest changes in sea-orm, different approach

Instead of the former approach to introduce a new error kind, now the existing error types get extended, for now only Exec and Query, because these are the most relevant for the requirement context.
Afterwards it might still be possible to add some further detail information.
See discussion https://github.com/SeaQL/sea-orm/discussions/709

* Update src/driver/sqlx_mysql.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* Update src/driver/sqlx_postgres.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* Update src/driver/sqlx_sqlite.rs

Integrating fixes done by @Sculas

Co-authored-by: Sculas <contact@sculas.xyz>

* feat: reworking feature with thiserror

Following the latest suggestions I changed the implementation to utilize `thiserror`.
Now there are more error kinds to be able to see the different kinds directly in src/error.rs
To ensure the behaviour is as expected, I also introduce a further test, which checks for a uniqueness failure.

Co-authored-by: Sculas <contact@sculas.xyz>
2022-08-28 11:13:51 +08:00
Chris Tsang
468d704bb0
Merge pull request #677 from SebastienGllmt/patch-1
Derive extra error traits
2022-05-09 21:19:02 +08:00
Billy Chan
498c0154ca Restructure SeaORM migration
Bump codegen's sea-query version [cli]

Update CLI subcommand method

Move migration utility into sea-orm-migration
2022-05-09 12:30:55 +08:00
Sebastien Guillemot
2f4eadcbac
Derive extra error traits 2022-04-19 19:37:20 +09:00
Billy Chan
351efd0d6b
Update ActiveModel by JSON (#492)
* Update ActiveModel by JSON

* Add `ActiveModel::from_json`

* Update test cases
2022-03-13 18:41:32 +08:00
Billy Chan
858e1e047d
Update docs 2021-11-02 14:34:08 +08:00
Billy Chan
6018d3f1b9
Merge remote-tracking branch 'origin/master' into active-enum 2021-11-02 12:18:37 +08:00
Charles Chege
f21492bf60 Document the error module 2021-10-29 10:40:16 +03:00
Billy Chan
f1ef7d9c47
Add DbErr::Type 2021-10-20 16:41:01 +08:00
Billy Chan
8900d03492
Merge fix 2021-10-12 20:42:15 +08:00
Chris Tsang
b6c1296333 Fix conflict 2021-10-12 13:07:02 +08:00
Billy Chan
08595c9729
Try DbErr::Custom 2021-10-04 11:45:24 +08:00
Billy Chan
0e0ee0ede6
Add TryFromU64 & test Uuid as primary key 2021-09-01 16:53:54 +08:00
Chris Tsang
e5f290380a Use ColumnFromStrErr 2021-08-23 01:06:25 +08:00
Chris Tsang
0e3439ee84 impl std::error::Error for DbErr 2021-08-08 00:01:58 +08:00
Chris Tsang
f5ac84f915 Rework DbErr 2021-06-30 23:56:26 +08:00
Chris Tsang
30ac326d5c Rename to DbErr::Exec and DbErr::Conn 2021-06-30 21:21:06 +08:00
Chris Tsang
0298cfb6af Rename to DbErr 2021-06-30 21:17:23 +08:00
Billy Chan
2a1173c174
Add & use OrmError (#36)
* Add & use OrmError

* Rename to SeaErr
2021-06-30 21:08:41 +08:00