Coverage for functions \ flipdare \ util \ error_util.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
14from flipdare.generated.shared.app_error_code import AppErrorCode
15from flipdare.generated import ErrorFieldSchema
16from flipdare.message.error_message import ErrorMessage
19class ErrorUtil:
21 @staticmethod
22 def missing_uid_msg(uid: str) -> tuple[AppErrorCode, str]:
23 msg = ErrorMessage.MISSING_DOC.formatted(
24 ErrorFieldSchema(
25 label="user",
26 field_name="User ID",
27 field_value=uid,
28 )
29 )
30 code = AppErrorCode.NOT_FOUND
31 return code, msg
33 @staticmethod
34 def missing_email_msg(email: str) -> tuple[AppErrorCode, str]:
35 msg = ErrorMessage.MISSING_DOC.formatted(
36 ErrorFieldSchema(
37 label="user",
38 field_name="Email",
39 field_value=email,
40 )
41 )
42 code = AppErrorCode.NOT_FOUND
43 return code, msg