Validation in RPC call?

  • Thread starter Phillip B Oldham
  • Start date
P

Phillip B Oldham

I'm building an RPC service, and I need to validate the input and
provide informative error messages to users. What would be the best
way to do this? Simple `if` statements each raising a custom
exception? `assert` statements inside a try/except block to
"translate" the assertion errors into something more meaningful?
 
T

Terry Reedy

Phillip said:
I'm building an RPC service, and I need to validate the input and
provide informative error messages to users. What would be the best
way to do this? Simple `if` statements each raising a custom
exception? `assert` statements inside a try/except block to
"translate" the assertion errors into something more meaningful?

Use 'if'. Asserts are for debugging program logic (and hence can be
optimized away), not for user input.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top