Unverified Commit 9457e0ab authored by Hong Minhee's avatar Hong Minhee
Browse files

Handle connection errors during sending activities

parent 14876137
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ Version 1.2.2

To be released.

 -  Handle connection errors (rather than HTTP errors) in
    the `Context.sendActivity()` method.

 -  Support the `fedify` command on Windows on ARM64 via x64 emulation.
    [[#160]]

+14 −1
Original line number Diff line number Diff line
@@ -152,7 +152,20 @@ export async function sendActivity(
  } else {
    request = await signRequest(request, rsaKey.privateKey, rsaKey.keyId);
  }
  const response = await fetch(request);
  let response: Response;
  try {
    response = await fetch(request);
  } catch (error) {
    logger.error(
      "Failed to send activity {activityId} to {inbox}:\n{error}",
      {
        activityId,
        inbox: inbox.href,
        error,
      },
    );
    throw error;
  }
  if (!response.ok) {
    let error;
    try {