def why_of

mlbend-huggingface@0.1.1.0 · main.bend:48

import mlbend-huggingface@0.1.1.0/main.bend as MlbendHuggingface
import Base
import bend-kit-http@0.36.0.0/http.bend as Http

48# The HTTP kit's error, as ours.
49def why_of(e: Http.Err) -> Err:
50  match e:
51    case Http.ErrConnect{code, why}:
52      ErrNet{code, why}
53    case Http.ErrTls{code, why}:
54      ErrNet{code, why}
55    case Http.ErrRead{code, why}:
56      ErrNet{code, why}
57    case Http.ErrWrite{code, why}:
58      ErrNet{code, why}
59    case Http.ErrUrl{}:
60      ErrNet{0, "a url bend cannot open"}
61    case Http.ErrDns{}:
62      ErrNet{0, "a name that does not resolve"}
63    case Http.ErrTimeout{}:
64      ErrNet{0, "the answer did not come in time"}
65    case Http.ErrRedirect{}:
66      ErrNet{0, "a redirect bend did not follow"}
67    case Http.ErrBad{}:
68      ErrNet{0, "a malformed answer"}

Uses (2)

Used by (2)