import { MessageErrors } from '../logic/messages/messagesTypes' ; import { ConversationErrors } from '../logic/conversations/conversationsTypes' ; /**
 * Define wether or not the error comes from a network error
 * We have the ApiError type but we can miss some native connection errors
 * So (unless proven otherwise) the most reliable is to refer on error names
 * Knowing that ApiError also use error names
 */ export const isNetworkError = ( error ) => error . name === 'NetworkError' || error . name === 'OfflineError' || error . name === 'TimeoutError' ; export const isNotExistError = ( error ) => error ?. data && ( error . data . Code === 2061 || error . data . Code === 2501 || error . data . Code === 20052 ) ; /**
 * It's an error from OpenPGP about decryption
 * Most of the time decryption errors are user key management pbs we have to ignore
 */ export const isDecryptionError = ( error ) => error . message && error . message . startsWith ( 'Error decrypting' ) ; export const hasError = ( errors = { } ) => ! ! Object . values ( errors ) . flat ( ) . length ; export const hasErrorType = ( errors = { } , errorType ) => ( ( errors as any ) ?. [ errorType ] ?. length || 0 ) > 0 ;