2023-03-28 23:55:57 +03:00
|
|
|
// Copyright (c) 2019-2023 Alexander Medvednikov. All rights reserved.
|
2021-10-19 16:03:45 +03: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 13:21:37 +03:00
|
|
|
// TimeParseError represents a time parsing error.
|
2021-10-19 16:03:45 +03:00
|
|
|
pub struct TimeParseError {
|
2022-02-11 16:52:33 +03:00
|
|
|
Error
|
2021-10-19 16:03:45 +03:00
|
|
|
code int
|
|
|
|
}
|
|
|
|
|
2022-04-05 13:21:37 +03:00
|
|
|
// msg implements the `IError.msg()` method for `TimeParseError`.
|
2022-02-11 16:52:33 +03:00
|
|
|
pub fn (err TimeParseError) msg() string {
|
2022-11-15 16:53:13 +03:00
|
|
|
return 'Invalid time format code: ${err.code}'
|
2022-02-11 16:52:33 +03:00
|
|
|
}
|
|
|
|
|
2021-10-19 16:03:45 +03:00
|
|
|
fn error_invalid_time(code int) IError {
|
|
|
|
return TimeParseError{
|
|
|
|
code: code
|
|
|
|
}
|
|
|
|
}
|