{"record":{"id":"37d8b79b80ae012e","repo":"perspective-dev/perspective","slug":"throw-perspectiveexception-message-c-str","errorCode":null,"errorMessage":"throw PerspectiveException(message.c_str())","messagePattern":"throw PerspectiveException\\(message\\.c_str\\(\\)\\)","errorType":"exception","errorClass":"PerspectiveException","httpStatus":null,"severity":"error","filePath":"rust/perspective-server/cpp/perspective/src/cpp/base.cpp","lineNumber":23,"sourceCode":"// ┃ █      ██████ █  ▀█▄       █ ██████      █      ███▌▐███ ███████▄ █       ┃\n// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫\n// ┃ Copyright (c) 2017, the Perspective Authors.                              ┃\n// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃\n// ┃ This file is part of the Perspective library, distributed under the terms ┃\n// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃\n// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\n#include <perspective/first.h>\n#include <perspective/base.h>\n#include <cstdint>\n#include <limits>\n#include <perspective/exception.h>\n\nnamespace perspective {\n\nvoid\npsp_abort(const std::string& message) {\n    throw PerspectiveException(message.c_str());\n}\n\nbool\nis_numeric_type(t_dtype dtype) {\n    switch (dtype) {\n        case DTYPE_UINT8:\n        case DTYPE_UINT16:\n        case DTYPE_UINT32:\n        case DTYPE_UINT64:\n        case DTYPE_INT8:\n        case DTYPE_INT16:\n        case DTYPE_INT32:\n        case DTYPE_INT64:\n        case DTYPE_FLOAT32:\n        case DTYPE_FLOAT64: {\n            return true;\n        } break;\n        default: {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-server/cpp/perspective/src/cpp/base.cpp#L5-L41","documentation":"`psp_abort` is Perspective's central C++ abort hook: it takes a message and throws `PerspectiveException(message.c_str())`, a custom C++ exception type. Any fatal internal condition in the Perspective engine (server or WASM) funnels through this function, so the message you see is the engine's description of the invariant or input that failed. In practice this surfaces to clients as an opaque 'PerspectiveException: <message>' error.","triggerScenarios":"Any code path in the C++ engine calling `psp_abort(<message>)` — e.g. on invalid data types, corrupted internal state, or violated invariants during table/view/computed-column operations; the exact condition is carried in the thrown message.","commonSituations":"Passing Arrow data with an unsupported schema, operations on a table/view that has been removed server-side, engine bugs or platform-specific issues in the compiled perspective-server, or mixing incompatible client/server versions.","solutions":["Read the exception message text — it names the specific engine invariant or input that failed","Verify client (perspective-js/python) and server versions match — cross-version protocol mismatches commonly abort the engine","Validate the input data schema/types before sending to the server (e.g. Arrow table dtypes)","If the message indicates an internal invariant with valid inputs, report it with a reproduction to the perspective-dev maintainers"],"exampleFix":"// before\nawait table.view({ columns: [\"typo_column\"] }); // engine aborts on unknown column\n// after\nconst cols = table.schema();\nif (!(\"typo_column\" in cols)) throw new Error(\"column not found\");\nawait table.view({ columns: [\"typo_column\"] });","handlingStrategy":"try-catch","validationCode":"// validate inputs before sending to the engine\nconst schema = table.schema();\nfor (const col of columns) {\n  if (!(col in schema)) throw new Error(`unknown column: ${col}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const view = await table.view({ columns });\n} catch (e) {\n  if (String(e).includes(\"PerspectiveException\")) {\n    console.error(\"engine abort:\", e.message);\n    // fall back to rebuilding the table from source data\n  }\n}","preventionTips":["Match client and server versions exactly","Validate data schema/dtypes before sending to the engine","Keep parent tables alive while views exist","Report unexpected PerspectiveException messages with a reproduction"],"tags":["cpp","exception","engine","internal-error"],"backgroundTag":"internal-invariant-violation","analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}