updatePassword( $localpart, $input["auth"]["password"], $input["new_password"] )) { throw new Exception("invalid credentials or another error while updating"); } } catch (Exception $e) { header("HTTP/1.0 500 Internal Error"); error_log("failed with error: " . $e->getMessage()); $response = [ "errorcode" => "M_UNKNOWN", "error" => $e->getMessage(), ]; } print (json_encode($response, JSON_PRETTY_PRINT)); ?>