Creates a `SqlState` from its error code.
(s: &str)
| 5 | impl SqlState { |
| 6 | /// Creates a `SqlState` from its error code. |
| 7 | pub fn from_code(s: &str) -> SqlState { |
| 8 | match Self::state(s) { |
| 9 | Some(state) => state, |
| 10 | None => SqlState(Inner::Other(s.into())), |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | /// Returns the error code corresponding to the `SqlState`. |
| 15 | pub fn code(&self) -> &str { |