DEV Community

Armando Ota
Armando Ota

Posted on

Don't do this #1

let this series be reminder to all of us what not to do and why not

#1: simple example

PHP Code using well known PHPMailer
function sendMail(...) {
...
$mail->send(); //DOUBLE PRETTY PLEASE WITH CREAM ON TOP GET RETURN VALUE
return true;
}

taken from PHPMailer API doc:
public send() : bool
Return values
bool — false on error - See the ErrorInfo property for details of the error

Lesson #1: read the API docs of what methods return
Lesson #2: handle error flows

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.