socket-function 0.136.0 → 0.137.0

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/SocketFunction.ts CHANGED
@@ -26,10 +26,10 @@ if (isNode()) {
26
26
  // not a good alternative to proper error log and notifications. Do you guys
27
27
  // not get automated emails when unexpected errors are logged? I do.
28
28
  process.on("unhandledRejection", (e) => {
29
- console.error("Unhandled rejection", e);
29
+ console.error("Unhandled rejection" + ((e as any)?.stack || e));
30
30
  });
31
31
  process.on("uncaughtException", (e) => {
32
- console.error("Uncaught exception", e);
32
+ console.error("Uncaught exception" + ((e as any)?.stack || e));
33
33
  });
34
34
  }
35
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.136.0",
3
+ "version": "0.137.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
package/src/https.ts CHANGED
@@ -96,7 +96,7 @@ export function httpsRequest(
96
96
  }
97
97
  return new Promise((resolve, reject) => {
98
98
  request.onload = () => {
99
- if (request.status !== 200) {
99
+ if (!request.status.toString().startsWith("2")) {
100
100
  try {
101
101
  // It should be an error.stack. But if it isn't... just throw the status text...
102
102
  let responseText = textDecoder.decode(request.response);
@@ -40,11 +40,11 @@ const noDiskLogPrefix = "█ ";
40
40
  export function measureFnc(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
41
41
  let name = propertyKey;
42
42
  if (target.name) {
43
- name = `${target.name}.${name}`;
43
+ name = `${target.name}|${name}`;
44
44
  } else {
45
45
  let constructorName = target.constructor.name;
46
46
  if (constructorName) {
47
- name = `${constructorName}().${name}`;
47
+ name = `${constructorName}()|${name}`;
48
48
  }
49
49
  }
50
50
  if (descriptor.value instanceof AsyncFunction) {
@@ -98,8 +98,7 @@ export async function startSocketServer(
98
98
  }
99
99
 
100
100
  watchTrustedCertificates(() => {
101
- // NOTE: If this is called a lot... STOP CALLING IT A LOT! Calling setSecureContext
102
- // so frequently likely leaks memory!
101
+ // NOTE: If this is called a lot... STOP CALLING IT A LOT! Calling setSecureContext frequently leaks memory! (As in, once a minute is maybe too much, once a second is definitely too much)
103
102
  console.log(`Updating websocket server trusted certificates`);
104
103
  lastOptions.ca = getTrustedCertificates();
105
104
  httpsServer.setSecureContext(lastOptions);