builtin: cleanup interface IError, remove the obsolete .code and .msg fields, deprecated in 2022-02-11 (#22063)

This commit is contained in:
yuyi 2024-08-17 14:53:46 +08:00 committed by GitHub
parent 8210593349
commit ee16f6f094
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 9 deletions

View File

@ -5,10 +5,6 @@ module builtin
// IError holds information about an error instance
pub interface IError {
// >> Hack to allow old style custom error implementations
// TODO: remove once deprecation period for `IError` methods has ended
msg string
code int // <<
msg() string
code() int
}
@ -43,10 +39,6 @@ pub fn (err IError) str() string {
(*err).str()
}
else {
// >> Hack to allow old style custom error implementations
// TODO: remove once deprecation period for `IError` methods has ended
// old_error_style := unsafe { voidptr(&err.msg) != voidptr(&err.code) } // if fields are not defined (new style) they don't have an offset between
// <<
'${err.type_name()}: ${err.msg()}'
}
}

View File

@ -54,7 +54,7 @@ pub fn test_handles_incomplete_requests() {
assert req.prev_len == 0
remaining_parsed := req.parse_request(' HTTP/1.1\r\n\r\n') or {
assert err.msg == 'error parsing request: invalid character "13"'
assert err.msg() == 'error parsing request: invalid character "13"'
0
}
assert remaining_parsed == 0