forked from georust/gdal
-
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.
Replace Option with Result georust#1: added errors based using error-…
…chain
- Loading branch information
Showing
3 changed files
with
26 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use libc::{c_int}; | ||
|
||
// Create the Error, ErrorKind, ResultExt, and Result types | ||
error_chain! { | ||
foreign_links { | ||
FfiNulError(::std::ffi::NulError); | ||
StrUtf8Error(::std::str::Utf8Error); | ||
} | ||
|
||
errors { | ||
CplError(class: c_int, number: c_int, msg: String) { | ||
description("GDAL internal error") | ||
display("CPL error class: '{}', error number: '{}', error msg: '{}'", class, number, msg) | ||
} | ||
NullPointer(method_name: &'static str) { | ||
description("GDAL method returned a NULL pointer.") | ||
display("GDAL method {} returned a NULL pointer.", method_name) | ||
} | ||
} | ||
} |
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