| 1 | // Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | module time |
| 5 | |
| 6 | // TimeParseError represents a time parsing error. |
| 7 | pub struct TimeParseError { |
| 8 | Error |
| 9 | code int |
| 10 | message string |
| 11 | } |
| 12 | |
| 13 | // msg implements the `IError.msg()` method for `TimeParseError`. |
| 14 | pub fn (err TimeParseError) msg() string { |
| 15 | return 'Invalid time format code: ${err.code}, error: ${err.message}' |
| 16 | } |
| 17 | |
| 18 | fn error_invalid_time(code int, message string) IError { |
| 19 | return TimeParseError{ |
| 20 | code: code |
| 21 | message: message |
| 22 | } |
| 23 | } |
| 24 | |