Skip to content

Type Alias: GoError ​

ts
type GoError = 
  | {
  code: "occupied";
  message: string;
  point: Point;
}
  | {
  code: "suicide";
  message: string;
  point: Point;
}
  | {
  code: "ko";
  message: string;
  point: Point;
}
  | {
  code: "off-board";
  message: string;
  point: Point;
}
  | {
  code: "game-over";
  message: string;
}
  | {
  code: "scoring";
  message: string;
}
  | {
  code: "not-scoring";
  message: string;
}
  | {
  code: "not-at-latest-move";
  message: string;
}
  | {
  code: "not-a-group";
  message: string;
  point: Point;
}
  | {
  code: "not-in-review";
  message: string;
}
  | {
  code: "unknown-move";
  message: string;
  move: MoveId;
}
  | {
  at: number;
  code: "invalid-sgf";
  message: string;
}
  | {
  code: "unplayable-sgf";
  message: string;
  move: number;
}
  | {
  code: "invalid-action";
  message: string;
};

Why a function refused. These are situations a correct caller can run into; a programmer error, such as a point that isn't integers or a value that isn't a game, throws instead.

Union Members ​

Type Literal ​

ts
{
  code: "occupied";
  message: string;
  point: Point;
}

Type Literal ​

ts
{
  code: "suicide";
  message: string;
  point: Point;
}

Type Literal ​

ts
{
  code: "ko";
  message: string;
  point: Point;
}

point can't be retaken yet.


Type Literal ​

ts
{
  code: "off-board";
  message: string;
  point: Point;
}

Type Literal ​

ts
{
  code: "game-over";
  message: string;
}

Type Literal ​

ts
{
  code: "scoring";
  message: string;
}

Moves wait while the count is being agreed.


Type Literal ​

ts
{
  code: "not-scoring";
  message: string;
}

Type Literal ​

ts
{
  code: "not-at-latest-move";
  message: string;
}

Play mode is a live game: moves are only played at the latest move of the main line. In either mode, a game ends (resign, acceptScore) only there.


Type Literal ​

ts
{
  code: "not-a-group";
  message: string;
  point: Point;
}

markGroup on an empty point.


Type Literal ​

ts
{
  code: "not-in-review";
  message: string;
}

Type Literal ​

ts
{
  code: "unknown-move";
  message: string;
  move: MoveId;
}

Type Literal ​

ts
{
  at: number;
  code: "invalid-sgf";
  message: string;
}

at is the character position where the file stopped making sense.


Type Literal ​

ts
{
  code: "unplayable-sgf";
  message: string;
  move: number;
}

move is the node in the file, counting the start as 0, that can't be played.


Type Literal ​

ts
{
  code: "invalid-action";
  message: string;
}

apply only: an action object it can't use.

Released under the MIT License.