package com.github.nullptroma.wallenc.domain.errors

import java.io.FileNotFoundException
import java.io.IOException

fun Throwable.toWallencException(): WallencException = when (this) {
    is WallencException -> this
    is FileNotFoundException -> WallencException.Storage.FileNotFound()
    is IOException -> WallencException.Network.IoFailed(this)
    else -> WallencException.Unknown(this)
}
