refactor(error): move error types to centralized location

Consolidate XError, XErrors, and FormErrors types into a single file for better maintainability and consistency across the codebase.
This commit is contained in:
Khafid Prayoga
2025-08-29 11:02:31 +07:00
parent d6b288404f
commit ee3bb1cd6e
4 changed files with 30 additions and 19 deletions
+27
View File
@@ -0,0 +1,27 @@
/**
* Base interface untuk error yang digunakan di seluruh aplikasi
*/
export interface XError {
/** Pesan error yang akan ditampilkan */
message: string
/** Kode error (opsional) */
code?: string
/** Nilai yang diharapkan (untuk validasi) */
expectedVal?: string
/** Nilai yang diberikan (untuk validasi) */
givenVal?: string
/** Path field yang error (untuk form validation) */
path?: (string | number)[]
/** Properties tambahan lainnya */
[key: string]: any
}
/**
* Collection of errors dengan key sebagai field name
*/
export type XErrors = Record<string, XError>
/**
* Form errors type alias untuk kompatibilitas
*/
export type FormErrors = XErrors