Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding exception mapper. t/10 is breaking on calling 'database'. Rela…
…ted to #69
- Loading branch information
Showing
10 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class X::Red is Exception {} | ||
|
||
class X::Red::Driver is X::Red { | ||
has Str $.driver = $*RED-DB.^name; | ||
} | ||
|
||
class X::Red::InvalidTableName is X::Red::Driver { | ||
has Str $.table; | ||
|
||
method message { "'$!table' is an invalid table name for driver { $.driver }" } | ||
} | ||
|
||
class X::Red::Driver::Mapped is X::Red::Driver { | ||
has Exception $.orig-exception is required; | ||
has Str $!orig-message = $!orig-exception.message; | ||
has Backtrace $!orig-backtrace = $!orig-exception.backtrace; | ||
|
||
method msg { !!! } | ||
|
||
method message { | ||
"{self.msg}\nOriginal error:\n{$!orig-message}" | ||
} | ||
|
||
method throw is hidden-from-backtrace { | ||
nextwith $!orig-backtrace | ||
} | ||
} | ||
|
||
class X::Red::Driver::Mapped::UnknownError is X::Red::Driver::Mapped { | ||
has Str @.fields; | ||
method msg { | ||
qq:to/END/ | ||
Unknown Error!!! | ||
Please, copy this backtrace and open an issue on https://github.com/FCO/Red/issues/new | ||
Driver: { $.driver } | ||
Original error: { $.orig-exception.perl } | ||
END | ||
} | ||
} | ||
|
||
class X::Red::Driver::Mapped::Unique is X::Red::Driver::Mapped { | ||
has Str @.fields; | ||
method msg { "Unique constraint ({@!fields.join: ", "}) violated" } | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters