YmerNode.Scripts.Throttle.Error exception (Ymer Node v0.2.1)

Copy Markdown View Source

A throttle's refusal of a request — the exception YmerNode.Script.Context.request/2 answers as {:error, exception} when a request never left the node.

An exception rather than a term, because Req's pipeline carries one: a request step refuses by halting with an exception, and Req.request/2 hands it back as it came. Its message is what a run's answer shows whichever way a script meets it. Handed back from run/3, YmerNode.Scripts.Runner renders it by its message after the script and the action; left in a failed {:ok, _} = match, its fields — the message among them — are printed inside the match error. So the reader learns what only the node knows either way: which throttle, what stopped the request, and the verb or the wait that answers it.

reason is :undeclared, :open or :deadline, and throttle is the name the request gave.

Summary

Functions

The throttle cannot give a token before the run's deadline: the wait would be needed milliseconds, and the run has left.

The throttle's breaker is open after failures consecutive 401s, and closes by itself in resumes_in milliseconds.

A request named a throttle its script's declarations do not name.

Functions

deadline(name, needed, left)

The throttle cannot give a token before the run's deadline: the wait would be needed milliseconds, and the run has left.

open(name, failures, resumes_in)

The throttle's breaker is open after failures consecutive 401s, and closes by itself in resumes_in milliseconds.

undeclared(name)

A request named a throttle its script's declarations do not name.