From ee16f6f0944fda8bba809c00f2721d278e099a97 Mon Sep 17 00:00:00 2001 From: yuyi Date: Sat, 17 Aug 2024 14:53:46 +0800 Subject: [PATCH] builtin: cleanup interface IError, remove the obsolete .code and .msg fields, deprecated in 2022-02-11 (#22063) --- vlib/builtin/result.v | 8 -------- vlib/picohttpparser/request_test.v | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/vlib/builtin/result.v b/vlib/builtin/result.v index 395a83ba08..74ba8098f9 100644 --- a/vlib/builtin/result.v +++ b/vlib/builtin/result.v @@ -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()}' } } diff --git a/vlib/picohttpparser/request_test.v b/vlib/picohttpparser/request_test.v index b9182bff3d..bc4935e700 100644 --- a/vlib/picohttpparser/request_test.v +++ b/vlib/picohttpparser/request_test.v @@ -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