Youtap Core Engine
Breadcrumbs

Mobile Error Codes and Corresponding Error Messages

This document outlines common error codes and their corresponding error messages that may occur in the Merchant app built with Flutter. It also includes a section to document the app's current handling of error codes.


Common Error Codes in Flutter

Below is a table of possible error codes and their corresponding error messages that developers may encounter while working with Flutter. These errors can occur during development, debugging, or runtime.

#

Error Message

Description

1

MissingPluginException

A required plugin is not implemented or not found.

2

PlatformException

An error occurred while communicating with the platform-specific code.

3

NoSuchMethodError

A method or property is called on an object that does not support it.

4

FormatException

The data is not in the expected format (e.g., JSON parsing failed).

5

TimeoutException

A network or asynchronous operation timed out.

6

SocketException

A network-related error, such as failing to connect to a server.

7

FileSystemException

An error occurred while accessing the file system (e.g., file not found).

8

StateError

The app is in an invalid state to perform the requested operation.

9

AssertionError

An assertion failed during development.

10

RangeError

A value is outside the valid range (e.g., accessing an invalid index in a list).

11

TypeError

A value is not of the expected type.

12

ArgumentError

An invalid argument was passed to a function.

13

UnsupportedError

The operation is not supported.

14

ConcurrentModificationError

A collection was modified while iterating over it.

15

Stack Overflow

The call stack exceeded its limit (e.g., infinite recursion).

16

Out of Memory

The app ran out of memory.

17

RenderBox Overflow

A widget exceeded the available space in the layout.

18

Null check operator used on a null value

A null value was accessed using the ! operator.

19

Invalid envelope

An error occurred while decoding a message from the platform channels.

20

Unable to load asset

A specified asset (e.g., image, font) could not be loaded.

21

DioError

An error occurred while making an HTTP request using the Dio package.

22

FirebaseException

An error occurred while interacting with Firebase services.

23

PermissionDeniedException

The app does not have the required permissions to perform an operation.

24

InvalidKeyException

An invalid key was used (e.g., in encryption or Firebase).

25

NetworkImageLoadException

An error occurred while loading an image from the network.


Notes on Error Codes

The table above does not cover all possible errors in Flutter. Here’s why:

  1. Dart Language Errors: Dart can throw a wide variety of errors, including custom exceptions defined by developers.

  2. Flutter Framework Errors: Errors related to widgets, rendering, and layout are specific to Flutter.

  3. Platform-Specific Errors: Errors can occur due to platform-specific behavior (e.g., Android, iOS, web).

  4. Plugin-Specific Errors: Plugins like Firebase, HTTP, or Camera can throw their own errors.

  5. Tooling and Build Errors: Errors can occur during the build process or while using Flutter tools.

  6. Custom Errors: Developers can define their own error classes, making the list of possible errors unbounded.


Current Handling of Error Codes in Merchant App

The Merchant app currently follows a strategy where error messages from the backend (BE) are displayed directly to the user in cases where the backend provides a specific error message. For example, if a login attempt fails, the app displays the exact error message returned by the API. This approach ensures consistency between the backend and frontend error messaging and provides users with clear and actionable feedback.

Key Characteristics of the Current System:

  1. Backend-Driven Error Messages:

    • When the backend returns an error message (e.g., for login failures, validation errors, or API exceptions), the app displays the same message to the user.

    • Example: If the backend returns "Invalid username or password", the app displays this exact message.

  2. Generic Fallback for Unhandled Errors:

    • For errors that are not explicitly handled or do not include a backend-provided message, the app displays a generic error message such as "Something went wrong. Please try again later."

    • This ensures that users are not exposed to technical details or unhelpful error codes.

  3. No Error Codes in UI:

    • Error codes are not shown to users in the UI. Instead, the focus is on providing clear and actionable messages.

  4. Limited Centralized Error Handling:

    • While backend-driven error messages are displayed consistently, there is no centralized system for handling all errors across the app.

    • Error handling is implemented on a case-by-case basis, which can lead to inconsistencies in how errors are managed.

  5. Reference to Backend Error Codes: