FIND YOUR NEXT FEW LINES

Results for “Errors & validation”

Small, practical examples. Search by task or narrow things down below.

135 snippets foundClear filters
PowerShellFunctions & control

Handle a terminating error

Catch conversion failures and produce a clear fallback.

try catch✓ Tested
PythonStructured data & serialization

Handle malformed JSON input

Python: Catch JSONDecodeError without hiding unrelated programming errors.

Python✓ Tested
HTMLInput constraints

Limit a numeric input to an inclusive range

HTML: Number inputs expose range validation separately from the entered text.

HTML✓ Tested
HTMLInput constraints

Limit typed text to a maximum length

HTML: Maxlength limits ordinary user editing without replacing server-side validation.

HTML✓ Tested
CFile positioning & lifecycle

Measure a small seekable binary file

C: Seek to the end and inspect ftell, checking both operations for errors.

C✓ Tested
PythonFunctions & error handling

Raise and catch a domain-specific exception

Python: Give a validation failure its own exception type so callers can handle it narrowly.

Python✓ Tested
HTMLInput constraints

Require a nonempty text value

HTML: The required attribute makes an empty text control fail native constraint validation.

HTML✓ Tested
SQLConstraints & defaults

Require a value with NOT NULL

SQL: Declare required fields at the database boundary, not only in application validation.

SQL✓ Tested
SQL ServerConstraints & defaults

Require a value with NOT NULL

SQL Server: Declare required fields at the database boundary, not only in application validation.

SQL Server✓ Tested
PostgresConstraints & defaults

Require a value with NOT NULL

Postgres: Declare required fields at the database boundary, not only in application validation.

Postgres✓ Tested
SQLiteConstraints & defaults

Require a value with NOT NULL

SQLite: Declare required fields at the database boundary, not only in application validation.

SQLite✓ Tested
TypeScriptTypes & functions

Type a function’s inputs and output

Catch mismatched arguments during compilation.

function✓ Tested