Skip to content

Commit 95d821a

Browse files
authored
feat(fabric-error): support kwargs with httpCode and returnValue (#37)
1 parent 1607b61 commit 95d821a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/core/ydata/core/error/fabric_error.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22
import json
3-
from typing import Optional
43
from sys import getsizeof
54

65

@@ -9,25 +8,31 @@ def _camelcased(value: str) -> str:
98
return capitalized[0].lower() + capitalized[1:]
109

1110

11+
# pylint: disable=too-many-arguments
1212
class FabricError(Exception):
13-
context: Optional[dict[str, str]]
13+
context: dict[str, str] | None
1414
description: str
1515
http_code: int = 500
16-
name: Optional[str]
16+
name: str | None
1717
return_value: int
1818

1919
def __init__(
2020
self,
21-
context: Optional[dict[str, str]] = None,
22-
description: Optional[str] = None,
23-
http_code: Optional[int] = None,
24-
name: Optional[str] = None):
21+
context: dict[str, str] | None = None,
22+
description: str | None = None,
23+
http_code: int | None = None,
24+
name: str = None,
25+
return_value: int | None = None,
26+
**kwargs):
2527
self.context = context
28+
self.name = name
29+
2630
if description:
2731
self.description = description
28-
if http_code:
29-
self.http_code = http_code
30-
self.name = name
32+
if http_code or kwargs.get('httpCode', None):
33+
self.http_code = http_code or kwargs.get('httpCode', None)
34+
if return_value or kwargs.get('returnValue', None):
35+
self.return_value = return_value or kwargs.get('returnValue', None)
3136

3237
def __iter__(self):
3338
yield from {

0 commit comments

Comments
 (0)