Errors and warnings
Every error code, the exact message it comes with, and what to do.
Catch an error
Every failure is a PrintError, with a code your code can check and an English message saying what went wrong:
import { PrintError } from "@taprel/sdk";
try {
await printer.printDocument(doc);
} catch (error) {
if (error instanceof PrintError && error.code === "AGENT_NOT_RUNNING") {
show("Please start or install the printing app.");
}
}
The messages below are exact. Parts in code style, like shop.example, change with the website, printer or document, and the app’s messages sometimes call it “the agent”. Looking for a symptom instead? See Troubleshooting.
Only four messages are written for the person at the computer: AGENT_NOT_RUNNING, BROWSER_BLOCKED, LICENSE_REQUIRED and LICENSE_UNAVAILABLE. For the others, show your own words and keep the message for your logs. PrintHelp has ready-made words, see Going live.
Connecting
AGENT_NOT_RUNNING
The printing app is not running on this computer. Start it, or install it if needed.
Start Taprel from the Start menu, or install it. If it’s already running and its Home page says “Websites can’t print”, another program uses the port it needs: closing that program or restarting the computer fixes it.
BROWSER_BLOCKED
The browser is blocking this website from reaching the printing app. Allow access to other apps and services on this device in the site settings, then reload the page.
Or, when the browser’s question was closed with its X:
The browser’s question was closed without an answer, so this website can’t reach the printing app. Reload the page or print again to be asked again, and choose Allow.
The person clicks the icon to the left of the web address, allows access to other apps and services on this device, then reloads the page. browserPermissionTexts.afterBlock says this for you. Pages on localhost never get this.
ORIGIN_NOT_ALLOWED
The user has not allowed
https://shop.exampleto use the printer agent
Someone answered Don’t allow in the app’s window. On the app’s Websites page, remove the website from Not allowed, then print again to be asked again.
CONTENT_SECURITY_POLICY
This website’s Content-Security-Policy blocks the connection to the printing app. Add
ws://127.0.0.1:21873to its connect-src directive.
Add ws://127.0.0.1:21873 to connect-src in your website’s Content-Security-Policy.
CONNECTION_LOST
The connection to the agent dropped before it answered. If this was a print, it may or may not have printed: check before trying again.
The app stopped or restarted, for example to update. The client connects again by itself. Check the paper, or the app’s Activity page, before printing again.
REQUEST_TIMEOUT
The agent did not answer “
print.document” in time. If this was a print, it may still print: check before trying again.
Usually the app’s question was left on screen without an answer. The client waits 150 seconds, the requestTimeoutMs option. Check before printing again.
Printers
PRINTER_NOT_FOUND
No printer named “
Front desk receipt”
No printer has that exact name: take it from listPrinters(). Or, when you asked for a type:
No printer of kind
Receipton this computer
No printer has that type: set a printer’s type on the app’s Printers page.
PRINTER_NOT_CHOSEN
Several printers of kind
Receipt: mark one as main on the agent’s Printers page, or give printer with the exact name
On the app’s Printers page, turn on Main printer of this type for one of them, or pass { printer: "Front desk receipt" }. See Printers.
LABEL_SIZE_MISSING
No label size: put it in the document, or set it on the agent’s Printers page
Give the size to label(content, { width: 50, height: 30 }), or set Label size on the printer’s page in the app.
FONT_MISSING
No font on this computer can print “
X”
X is the character. The app draws text with its own fonts, for Latin, Greek, Cyrillic and Arabic, then tries the computer’s. When none has it, install a Windows font that has the character, or leave it out.
PRINT_FAILED
The message is what Windows or the printer’s driver said. Check that the printer prints from Windows itself, for example with a Windows test page. For a PDF with paper, the driver may have refused that paper size.
Licence
LICENSE_REQUIRED
For a website:
shop.exampledoesn’t have a Taprel licence for this computer. The website’s owner can fix this by adding the domain to their Taprel account, and starting a trial or a plan.
Add the domain to your account, and start the trial or a plan. It also comes after a plan’s 14 days of warnings. See Going live.
On your own computer, after the free prints:
This computer has used today’s 50 free print jobs for local development. They start again at midnight. To print more, link this computer to a paid Taprel plan: Taprel’s Settings page shows the code.
For a local address:
http://192.168.1.10:8080is a local address, so this computer has to be linked to a paid Taprel plan. Taprel’s Settings page shows the code.
Link the computer to your account, during its trial or on a paid plan.
LICENSE_UNAVAILABLE
Taprel can’t confirm this website’s licence right now, because the licence server can’t be reached. Check the internet connection and try again.
The app keeps its last answer for up to 30 days, so this only happens when it has no recent one. Check the internet connection and print again.
Your request
BAD_REQUEST
content[3].align: must be start, center or end
The place in your document or options, then what’s wrong with it. The place counts after skipped values (false, null and so on) are left out, so look it up in the document’s content, not in the list you wrote.
INTERNAL
A bug in the app. Please email us the message and what you sent.
Warnings
A warning means printing still happened, but something couldn’t be done. Warnings come back in the result’s warnings, like { code: "CUT_NOT_AVAILABLE", path: "content[5]" }, with no message, so show your own words.
| Code | What it means |
|---|---|
CUT_NOT_AVAILABLE |
This printer’s route can’t cut the paper |
DRAWER_NOT_AVAILABLE |
This printer’s route can’t open the cash drawer |
PAGE_CUT_OFF |
Some of the document didn’t fit on the page |
TEXT_CUT_OFF |
A label’s text had too many lines to fit |
SIZE_DIFFERS_FROM_PRINTER |
The label size differs from the printer’s setting, so the wrong roll is probably loaded |
Like BAD_REQUEST, path counts after skipped values are left out.