21 lines
317 B
Odin
21 lines
317 B
Odin
package main
|
|
|
|
import "core:fmt"
|
|
import "core:strings"
|
|
ErrorType :: enum {
|
|
Config,
|
|
API,
|
|
}
|
|
|
|
Error :: struct {
|
|
type: ErrorType,
|
|
message: string,
|
|
}
|
|
|
|
format_error :: proc(err: ^Error) -> string {
|
|
sb := strings.builder_make(context.temp_allocator)
|
|
|
|
return fmt.sbprintf(&sb, "[%s] => %s", err.type, err.message)
|
|
}
|
|
|