openUrl
openUrl opens url with the platform's default handler (browser, mail client, etc.), the same effect as double-clicking a link.
Signature
openUrl(url: string): Result<void, OsError>tyrus
import { OsError, openUrl } from "tyrus:os";
match (openUrl("https://example.com")) {
Ok() => print("URL opened"); // URL opened
Err(error) => printError(`${error.code}: ${error.message}`); // ERR_OS_NO_HANDLER: no application is registered to open this URL
}Returns Err(OsError) (code: "ERR_OS_NO_HANDLER") if no application is registered to open url.
OsError Fields
| Field | Type | Meaning |
|---|---|---|
code | string | A stable, machine-readable identifier (e.g. "ERR_OS_NO_HANDLER"). |
message | string | A human-readable description of what went wrong. |
