# Custom Error 在 Solidity 0.8.0 版本前,當不符合程式所制定之條件時,可以利用 revert 或 require 來中止交易並回傳錯誤提示,以 revert 舉例,當使用者觸發 revert 時,會消耗一定數量的 gas,且會隨著回傳的提示文字來增加 gas 的數量。  而使用 Custom Error 的話,則可以降低 gas 的消耗數量。  Custom Error 也能自訂參數,當錯誤發生的時候會以 JSON 的方式顯示,能讓 DAPP 較好處理錯誤資訊,但顯示資料也代表需要額外花費 gas。 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up