-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07ed5be
commit af722e8
Showing
5 changed files
with
49 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
abstract type BONException <: Base.Exception end | ||
abstract type SeederException <: BONException end | ||
|
||
Base.showerror(io::IO, e::E) where {E <: BONException} = | ||
tprint( | ||
io, | ||
"{bold red}$(supertype(E)){/bold red} | {bold yellow}$E{/bold yellow}\n" * | ||
_error_message(e), | ||
) | ||
|
||
function _check_arguments(sampler::S) where {S <: BONSeeder} | ||
sampler.numpoints > 1 || _throw(TooFewSites) | ||
return sampler.numpoints <= n || _throw(TooManySites) | ||
end | ||
|
||
struct TooFewSites{I} <: BONException where {I <: Integer} | ||
provided_sites::I | ||
end | ||
_error_message(tfs::TooFewSites) = | ||
"Number of sampling sites provided was $(tfs.provided_sites), but the number of sites must be {bold}greater than {cyan}1{/cyan}{/bold}.\n" | ||
|
||
struct TooManySites{I} <: BONException where {I <: Integer} | ||
provided_sites::I | ||
maximum_sites::I | ||
end | ||
_error_message(tms::TooManySites) = | ||
"Number of sampling sites provided was $(tms.provided_sites), which {bold}exceeds the maximum possible{/bold} number of sites, $(tms.maximum_sites).\n" |
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