Files
Noa 207e559859 Noa/ts module host changes (#3388)
# Description of Changes

Host-side changes extracted from #3327 

I added AUTO_INC_OVERFLOW even though we don't currently ever return it,
in order to future-proof so it's already there when we start emitting
it.

Prepublish was failing because it was expecting a wasm module
unconditionally, so now it takes ?host_type.

I tweaked JS deser to accept null/undefined when the unit type or an
option type is expected.

I switched to bsatn, because the native sats->js translator wasn't
matching what js was expecting.

I renamed the sys module: my thinking is that `spacetime:` as a scheme
will help disambiguate it, and maybe it could also be used for IMC in
the future or something? And I believe we had discussed wanting this to
be versioned, similar to wasm imports.

Trying to get a borrowed str from deserialize_js doesn't work, because
v8 strings don't store utf8.

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

- [x] All this was done in the course of getting an actual typescript
module to successfully publish.
2025-10-10 18:25:26 +00:00

88 lines
2.3 KiB
C#

namespace SpacetimeDB;
using SpacetimeDB.Internal;
public abstract class StdbException : Exception
{
public abstract override string Message { get; }
}
public class NotInTransactionException : StdbException
{
public override string Message => "ABI call can only be made while in a transaction";
}
public class BsatnDecodeException : StdbException
{
public override string Message => "Couldn't decode the BSATN to the expected type";
}
public class NoSuchTableException : StdbException
{
public override string Message => "No such table";
}
public class NoSuchIndexException : StdbException
{
public override string Message => "No such index";
}
public class IndexNotUniqueException : StdbException
{
public override string Message => "The index was not unique";
}
public class NoSuchRowException : StdbException
{
public override string Message => "The row was not found, e.g., in an update call";
}
public class UniqueConstraintViolationException : StdbException
{
public override string Message => "Value with given unique identifier already exists";
}
public class ScheduleAtDelayTooLongException : StdbException
{
public override string Message => "Specified delay in scheduling row was too long";
}
public class BufferTooSmallException : StdbException
{
public override string Message => "The provided buffer is not large enough to store the data";
}
public class NoSuchIterException : StdbException
{
public override string Message => "The provided row iterator does not exist";
}
public class NoSuchLogStopwatch : StdbException
{
public override string Message => "The provided stopwatch does not exist";
}
public class NoSuchBytesException : StdbException
{
public override string Message => "The provided bytes source or sink does not exist";
}
public class NoSpaceException : StdbException
{
public override string Message => "The provided bytes sink has no more room left";
}
public class AutoIncOverflowException : StdbException
{
public override string Message => "The auto-increment sequence overflowed";
}
public class UnknownException : StdbException
{
private readonly Errno code;
internal UnknownException(Errno code) => this.code = code;
public override string Message => $"SpacetimeDB error code {code}";
}