~/bend-docscommunity

src/errno.bend checks

raw source on the hub · import ezsys@0.2.0.0/src/errno.bend as Errno

ezsys/src/errno: a file operation's failure written as Python writes an OSError: [Errno N] <strerror>: <repr(path)>. The text of a code is glibc's, from a table of common Linux codes; a code the table does not list is written with the message it came with. The path is written as Python's repr(str) writes it, for the characters up to U+00FF.

1 import
import Base

Definitions

def err.Table source · line 9 · raw

Data

the codes and their texts, reusable

def err.table.low source · line 13 · raw

err.Table

codes 1 to 25 and their texts

def err.table.high source · line 43 · raw

err.Table

codes 26 to 125 and their texts

def err.table source · line 73 · raw

err.Table

the common Linux codes and glibc's text for each, as os.strerror gives it: the classic codes 1 to 25, then the rest

def err.when source · line 77 · raw

@hit:Bool -> @yes:(@_:Unit -> String) -> @no:(@_:Unit -> String) -> String

what is written when hit holds, else what the rest writes

def err.look source · line 85 · raw

@table:err.Table -> @+code:U32 -> @+why:String -> String

the text of the first pair with the code, or why when there is none

def err.text source · line 93 · raw

@+code:U32 -> @+why:String -> String

a code's text: the table's, or why when the table does not list it

def err.quote.pick source · line 97 · raw

@dq:Bool -> Char

the quote a path is written between: " when it holds a ' and no ", else '

def err.quote source · line 105 · raw

@+path:String -> Char

the quote repr picks for a path

def err.hexed source · line 111 · raw

@+cp:U32 -> Bool

the code points repr writes as \xhh: below U+0020, U+007F to U+00A0, and U+00AD

def err.hex.or source · line 117 · raw

@got:Maybe<&2, Char> -> Char

a digit's character, or '0' past the digits

def err.hex.digit source · line 125 · raw

@num:U32 -> Char

the lowercase hex digit of a number's last four bits

def err.hex2 source · line 129 · raw

@+cp:U32 -> String

two lowercase hex digits of a number's last eight bits

def err.ctl source · line 133 · raw

@+cp:U32 -> String

a control character: \t, \n, \r, or \xhh

def err.plain source · line 140 · raw

@+qt:Char -> @+cp:U32 -> String

any other character: a backslash or the quote escaped, else itself

def err.esc source · line 146 · raw

@+qt:Char -> @chr:Char -> String

one character of a path between the quote q

def err.go source · line 152 · raw

@+qt:Char -> @path:String -> String

a path's characters between the quote q

def err.repr source · line 160 · raw

@+path:String -> String

a path as Python's repr(str) writes it

def err.os source · line 165 · raw

@+code:U32 -> @+why:String -> @+path:String -> String

a failed file operation as Python's OSError writes it