Cairo provides robust error handling mechanisms for smart contracts. When an error occurs during contract execution, the transaction is immediately reverted and all state changes are undone.
While Cairo provides assertion macros like assert_eq! and assert_ne!, these are only for testing. In contract code, always use the standard assert function.