2022-01-04 10:21:08 +01:00
|
|
|
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
|
2021-10-19 15:03:45 +02:00
|
|
|
// Use of this source code is governed by an MIT license
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
module time
|
|
|
|
|
2022-04-05 12:21:37 +02:00
|
|
|
// TimeParseError represents a time parsing error.
|
2021-10-19 15:03:45 +02:00
|
|
|
pub struct TimeParseError {
|
2022-02-11 14:52:33 +01:00
|
|
|
Error
|
2021-10-19 15:03:45 +02:00
|
|
|
code int
|
|
|
|
}
|
|
|
|
|
2022-04-05 12:21:37 +02:00
|
|
|
// msg implements the `IError.msg()` method for `TimeParseError`.
|
2022-02-11 14:52:33 +01:00
|
|
|
pub fn (err TimeParseError) msg() string {
|
|
|
|
return 'Invalid time format code: $err.code'
|
|
|
|
}
|
|
|
|
|
2021-10-19 15:03:45 +02:00
|
|
|
fn error_invalid_time(code int) IError {
|
|
|
|
return TimeParseError{
|
|
|
|
code: code
|
|
|
|
}
|
|
|
|
}
|