Correct double read of thread information on VM_START, this took awhile to find lol.
[SquirrelJME.git] / modules / debug-jdwp / src / main / java / cc / squirreljme / jdwp / JDWPCommandException.java
blobb73203eee124bc011bc23c0537f3f1274b55ec33
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.jdwp;
12 /**
13 * This is thrown when there is an error parsing and executing a packet.
15 * @since 2021/04/11
17 public class JDWPCommandException
18 extends JDWPException
20 /** The type of error this is. */
21 public final JDWPErrorType type;
23 /**
24 * Initializes the exception.
26 * @param __errorType The error type.
27 * @param __m The message for the error.
28 * @since 2021/04/11
30 public JDWPCommandException(JDWPErrorType __errorType, String __m)
32 super(__m);
34 this.type = (__errorType == null ? JDWPErrorType.INTERNAL :
35 __errorType);
38 /**
39 * Initializes the exception.
41 * @param __errorType The error type.
42 * @param __m The message for the error.
43 * @param __c The cause.
44 * @since 2021/04/15
46 public JDWPCommandException(JDWPErrorType __errorType, String __m,
47 Throwable __c)
49 super(__m, __c);
51 this.type = (__errorType == null ? JDWPErrorType.INTERNAL :
52 __errorType);
55 /**
56 * Generates an exception for an invalid class.
58 * @param __obj The context.
59 * @param __cause The cause of this exception.
60 * @return The exception.
61 * @since 2021/04/15
63 public static JDWPCommandException tossInvalidClass(Object __obj,
64 Throwable __cause)
66 return JDWPErrorType.INVALID_CLASS.toss(__obj,
67 System.identityHashCode(__obj), __cause);
70 /**
71 * Generates an exception for an invalid method.
73 * @param __obj The context.
74 * @param __methodDx The method index.
75 * @param __cause The cause of this exception.
76 * @return The exception.
77 * @since 2021/04/15
79 public static JDWPCommandException tossInvalidMethod(Object __obj,
80 int __methodDx, Throwable __cause)
82 return JDWPErrorType.INVALID_METHOD_ID.toss(__obj, __methodDx,
83 __cause);
86 /**
87 * Generates an exception for an invalid method.
89 * @param __obj The context.
90 * @param __fieldDx The field index.
91 * @param __cause The cause of this exception.
92 * @return The exception.
93 * @since 2021/04/16
95 public static JDWPCommandException tossInvalidField(Object __obj,
96 int __fieldDx, Throwable __cause)
98 return JDWPErrorType.INVALID_FIELD_ID.toss(__obj, __fieldDx,
99 __cause);