mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
SMTPError is a rather an interface than real class
This commit is contained in:
+6
-4
@@ -70,13 +70,15 @@ declare namespace SMTPConnection {
|
||||
dsn?: DSNOptions;
|
||||
}
|
||||
|
||||
class SMTPError extends Error {
|
||||
interface SMTPError extends NodeJS.ErrnoException {
|
||||
/** string code identifying the error, for example ‘EAUTH’ is returned when authentication */
|
||||
code: string;
|
||||
code?: string;
|
||||
/** the last response received from the server (if the error is caused by an error response from the server) */
|
||||
response: string;
|
||||
response?: string;
|
||||
/** the numeric response code of the response string (if available) */
|
||||
responseCode: number;
|
||||
responseCode?: number;
|
||||
/** command which provoked an error */
|
||||
command?: string;
|
||||
}
|
||||
|
||||
interface SentMessageInfo {
|
||||
|
||||
@@ -1036,9 +1036,10 @@ namespace smtp_connection_test {
|
||||
if (err) throw err;
|
||||
connection.send({ from: 'a@example.com', to: 'b@example.net' }, 'message', (err, info) => {
|
||||
if (err) {
|
||||
const code: string = err.code;
|
||||
const response: string = err.response;
|
||||
const responseCode: number = err.responseCode;
|
||||
const code: string = err.code || '???';
|
||||
const response: string = err.response || '???';
|
||||
const responseCode: number = err.responseCode || 0;
|
||||
const command: string = err.command || '???';
|
||||
throw err;
|
||||
}
|
||||
connection.reset(() => {
|
||||
|
||||
Reference in New Issue
Block a user