GitRoot

Craft your forge, Build your project, Grow your community freely
 1// SPDX-FileCopyrightText: 2026 Romain Maneschi <romain@gitroot.dev>
 2//
 3// SPDX-License-Identifier: MIT
 4
 5export function errorOrNull(ptrSize: i64): Error | null {
 6  if (ptrSize === 0) {
 7    return null;
 8  }
 9  const ptr = u32((ptrSize >> 32) & 0xffffffff);
10  const size = u32(ptrSize & 0xffffffff);
11  return new Error(String.UTF8.decodeUnsafe(ptr, size));
12}