aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/dgram.exports.js
blob: 65b531baaac461c022af90656f5cbd9b065adba2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// This is a stub! None of this is actually implemented yet.

function hideFromStack(fns) {
  for (const fn of fns) {
    Object.defineProperty(fn, "name", {
      value: "::bunternal::",
    });
  }
}

class TODO extends Error {
  constructor(messageName) {
    const message = messageName
      ? `node:dgram ${messageName} is not implemented yet in Bun. Track the status and thumbs up the issue: https://github.com/oven-sh/bun/issues/1630`
      : `node:dgram is not implemented yet in Bun. Track the status and thumbs up the issue: https://github.com/oven-sh/bun/issues/1630`;
    super(message);
    this.name = "TODO";
  }
}

function notimpl(message) {
  throw new TODO(message);
}

function createSocket() {
  notimpl("createSocket");
}

function Socket() {
  notimpl("Socket");
}

function _createSocketHandle() {
  notimpl("_createSocketHandle");
}

const defaultObject = {
  createSocket,
  Socket,
  _createSocketHandle,
  [Symbol.for("CommonJS")]: 0,
};

export { defaultObject as default, Socket, createSocket, _createSocketHandle };

hideFromStack([TODO.prototype.constructor, notimpl, createSocket, Socket, _createSocketHandle]);