@upyo/smtp 0.6.0-dev.301 → 0.6.0-dev.303

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -897,11 +897,11 @@ var SmtpConnection = class {
897
897
  const response = await this.sendCommand(`EHLO ${this.config.localName}`, signal);
898
898
  if (response.code === 500 || response.code === 502) {
899
899
  const heloResponse = await this.sendCommand(`HELO ${this.config.localName}`, signal);
900
- if (heloResponse.code !== 250) throw new Error(`HELO failed: ${heloResponse.message}`);
900
+ if (heloResponse.code !== 250) throw new SmtpResponseError(`HELO failed: ${heloResponse.message}`, heloResponse.code, "HELO", heloResponse.message);
901
901
  this.capabilities = [];
902
902
  return;
903
903
  }
904
- if (response.code !== 250) throw new Error(`EHLO failed: ${response.message}`);
904
+ if (response.code !== 250) throw new SmtpResponseError(`EHLO failed: ${response.message}`, response.code, "EHLO", response.message);
905
905
  this.capabilities = response.raw.split("\r\n").filter((line) => line.startsWith("250-") || line.startsWith("250 ")).slice(1).map((line) => line.substring(4)).filter((line) => line.length > 0);
906
906
  }
907
907
  async starttls(signal) {
@@ -909,7 +909,7 @@ var SmtpConnection = class {
909
909
  if (this.socket instanceof node_tls.TLSSocket) throw new Error("Connection is already using TLS");
910
910
  signal?.throwIfAborted();
911
911
  const response = await this.sendCommand("STARTTLS", signal);
912
- if (response.code !== 220) throw new Error(`STARTTLS failed: ${response.message}`);
912
+ if (response.code !== 220) throw new SmtpResponseError(`STARTTLS failed: ${response.message}`, response.code, "STARTTLS", response.message);
913
913
  signal?.throwIfAborted();
914
914
  return new Promise((resolve, reject) => {
915
915
  const timeout = setTimeout(() => {
@@ -1983,7 +1983,7 @@ var SmtpTransport = class {
1983
1983
  await connection.connect(signal);
1984
1984
  signal?.throwIfAborted();
1985
1985
  const greeting = await connection.greeting(signal);
1986
- if (greeting.code !== 220) throw new Error(`Server greeting failed: ${greeting.message}`);
1986
+ if (greeting.code !== 220) throw new SmtpResponseError(`Server greeting failed: ${greeting.message}`, greeting.code, "GREETING", greeting.message);
1987
1987
  signal?.throwIfAborted();
1988
1988
  await connection.ehlo(signal);
1989
1989
  signal?.throwIfAborted();
package/dist/index.js CHANGED
@@ -874,11 +874,11 @@ var SmtpConnection = class {
874
874
  const response = await this.sendCommand(`EHLO ${this.config.localName}`, signal);
875
875
  if (response.code === 500 || response.code === 502) {
876
876
  const heloResponse = await this.sendCommand(`HELO ${this.config.localName}`, signal);
877
- if (heloResponse.code !== 250) throw new Error(`HELO failed: ${heloResponse.message}`);
877
+ if (heloResponse.code !== 250) throw new SmtpResponseError(`HELO failed: ${heloResponse.message}`, heloResponse.code, "HELO", heloResponse.message);
878
878
  this.capabilities = [];
879
879
  return;
880
880
  }
881
- if (response.code !== 250) throw new Error(`EHLO failed: ${response.message}`);
881
+ if (response.code !== 250) throw new SmtpResponseError(`EHLO failed: ${response.message}`, response.code, "EHLO", response.message);
882
882
  this.capabilities = response.raw.split("\r\n").filter((line) => line.startsWith("250-") || line.startsWith("250 ")).slice(1).map((line) => line.substring(4)).filter((line) => line.length > 0);
883
883
  }
884
884
  async starttls(signal) {
@@ -886,7 +886,7 @@ var SmtpConnection = class {
886
886
  if (this.socket instanceof TLSSocket) throw new Error("Connection is already using TLS");
887
887
  signal?.throwIfAborted();
888
888
  const response = await this.sendCommand("STARTTLS", signal);
889
- if (response.code !== 220) throw new Error(`STARTTLS failed: ${response.message}`);
889
+ if (response.code !== 220) throw new SmtpResponseError(`STARTTLS failed: ${response.message}`, response.code, "STARTTLS", response.message);
890
890
  signal?.throwIfAborted();
891
891
  return new Promise((resolve, reject) => {
892
892
  const timeout = setTimeout(() => {
@@ -1960,7 +1960,7 @@ var SmtpTransport = class {
1960
1960
  await connection.connect(signal);
1961
1961
  signal?.throwIfAborted();
1962
1962
  const greeting = await connection.greeting(signal);
1963
- if (greeting.code !== 220) throw new Error(`Server greeting failed: ${greeting.message}`);
1963
+ if (greeting.code !== 220) throw new SmtpResponseError(`Server greeting failed: ${greeting.message}`, greeting.code, "GREETING", greeting.message);
1964
1964
  signal?.throwIfAborted();
1965
1965
  await connection.ehlo(signal);
1966
1966
  signal?.throwIfAborted();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/smtp",
3
- "version": "0.6.0-dev.301",
3
+ "version": "0.6.0-dev.303",
4
4
  "description": "SMTP transport for Upyo email library",
5
5
  "keywords": [
6
6
  "email",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "sideEffects": false,
55
55
  "peerDependencies": {
56
- "@upyo/core": "0.6.0-dev.301+877ca1c9"
56
+ "@upyo/core": "0.6.0-dev.303+d776cb0f"
57
57
  },
58
58
  "devDependencies": {
59
59
  "tsdown": "^0.12.7",