-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and move exceptions to their own file
- Loading branch information
Showing
6 changed files
with
49 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ lib | |
app | ||
*.dwarf | ||
*.DS_Store | ||
bin/ameba | ||
bin | ||
|
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 |
---|---|---|
|
@@ -2,5 +2,5 @@ version: 2.0 | |
shards: | ||
ameba: | ||
git: https://github.com/veelenga/ameba.git | ||
version: 0.14.0 | ||
version: 1.1.0 | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: bindata | ||
version: 1.10.0 | ||
version: 1.11.0 | ||
crystal: ">= 1.0.0" | ||
|
||
development_dependencies: | ||
|
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,41 @@ | ||
abstract class BinData | ||
class CustomException < Exception | ||
getter klass : String? | ||
getter field : String? | ||
getter field_type : String? | ||
|
||
def initialize(message, ex : Exception) | ||
super(message, ex) | ||
end | ||
|
||
def initialize(message) | ||
super(message) | ||
end | ||
end | ||
|
||
class VerificationException < CustomException; end | ||
|
||
class WritingVerificationException < VerificationException | ||
def initialize(@klass, @field, @field_type) | ||
super("Failed to verify writing #{field_type} at #{klass}.#{field}") | ||
end | ||
end | ||
|
||
class ReadingVerificationException < VerificationException | ||
def initialize(@klass, @field, @field_type) | ||
super("Failed to verify reading #{field_type} at #{klass}.#{field}") | ||
end | ||
end | ||
|
||
class ParseError < CustomException | ||
def initialize(@klass, @field, ex : Exception) | ||
super("Failed to parse #{klass}.#{field}", ex) | ||
end | ||
end | ||
|
||
class WriteError < CustomException | ||
def initialize(@klass, @field, ex : Exception) | ||
super("Failed to write #{klass}.#{field}", ex) | ||
end | ||
end | ||
end |