Add checks to not give a result if a thread is not suspended.
[SquirrelJME.git] / modules / debug-jdwp / src / main / java / cc / squirreljme / jdwp / JDWPCommandException.java
blob83ea6ab4974fab09f278f454e9cfbd3719d06c9f
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 * @since 2024/01/26
29 public JDWPCommandException(JDWPErrorType __errorType)
31 this.type = (__errorType == null ? JDWPErrorType.INTERNAL :
32 __errorType);
35 /**
36 * Initializes the exception.
38 * @param __errorType The error type.
39 * @param __m The message for the error.
40 * @since 2021/04/11
42 public JDWPCommandException(JDWPErrorType __errorType, String __m)
44 super(__m);
46 this.type = (__errorType == null ? JDWPErrorType.INTERNAL :
47 __errorType);
50 /**
51 * Initializes the exception.
53 * @param __errorType The error type.
54 * @param __m The message for the error.
55 * @param __c The cause.
56 * @since 2021/04/15
58 public JDWPCommandException(JDWPErrorType __errorType, String __m,
59 Throwable __c)
61 super(__m, __c);
63 this.type = (__errorType == null ? JDWPErrorType.INTERNAL :
64 __errorType);
67 /**
68 * Generates an exception for an invalid class.
70 * @param __obj The context.
71 * @param __cause The cause of this exception.
72 * @return The exception.
73 * @since 2021/04/15
75 public static JDWPCommandException tossInvalidClass(Object __obj,
76 Throwable __cause)
78 return JDWPErrorType.INVALID_CLASS.toss(__obj,
79 System.identityHashCode(__obj), __cause);
82 /**
83 * Generates an exception for an invalid method.
85 * @param __obj The context.
86 * @param __methodDx The method index.
87 * @param __cause The cause of this exception.
88 * @return The exception.
89 * @since 2021/04/15
91 public static JDWPCommandException tossInvalidMethod(Object __obj,
92 int __methodDx, Throwable __cause)
94 return JDWPErrorType.INVALID_METHOD_ID.toss(__obj, __methodDx,
95 __cause);
98 /**
99 * Generates an exception for an invalid method.
101 * @param __obj The context.
102 * @param __fieldDx The field index.
103 * @param __cause The cause of this exception.
104 * @return The exception.
105 * @since 2021/04/16
107 public static JDWPCommandException tossInvalidField(Object __obj,
108 int __fieldDx, Throwable __cause)
110 return JDWPErrorType.INVALID_FIELD_ID.toss(__obj, __fieldDx,
111 __cause);