/* * Copyright 2023 Magnus Madsen * * Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE.md file. */pubmod IoError {////// An error that can occur when performing I/O operations involving the file system.////// The first element describes the general kind of error that occurred./// This can be used to determine the correct action to take to handle specific kinds of errors.////// The second element is a string that describes the error, meant to be used for debugging purposes.///pubenumIoError(IoError.ErrorKind, String) withEq, ToStringinstanceFormattable[IoError] {pubdefformat(e: IoError): RichString = matche {case IoError.IoError(kind, msg) =>Formattable.format(kind) +RichString.fromString(": ") +RichString.fromString(msg) } }pubenumErrorKindwithEq, ToString {case AlreadyExistscase ChecksumMismatchcase Conflictcase ConnectionFailedcase Interruptedcase InvalidPathcase InvalidInputcase InvalidDatacase NotFoundcase NotFilecase NotDirectorycase PermissionDeniedcase TransferLimitExceededcase Timeoutcase UnexpectedEofcase Unsupportedcase UnknownHostcase Other }instanceFormattable[ErrorKind] {pubdefformat(k: ErrorKind): RichString = RichString.fromString(ToString.toString(k)) }}