Improve startup error reporting

This commit is contained in:
PikaMug 2020-01-17 05:05:15 -05:00
parent 39826eb0b8
commit fbf00c4cf4
4 changed files with 473 additions and 528 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,44 +14,17 @@ package me.blackvein.quests.exceptions;
import me.blackvein.quests.Quest;
/**
* This is the InvalidStageException class, this exception is used to indicate
* that the new stage of a quest does not exist. This is currently used in the
* Quest class when advancing to the next stage or manually setting the stage.
*
* @author Zino
* @author Blackvein
* @since 1.7.1-SNAPSHOT
* @version 3
* @see Quest#nextStage(me.blackvein.quests.Quester)
* @see Quest#setStage(me.blackvein.quests.Quester, int)
*/
public class InvalidStageException extends Exception {
/**
* The version id to use when serialising and deserialising this class.
*/
private static final long serialVersionUID = 1778748295752972651L;
/**
* The Quest instance that an invalid stage was set within.
*/
private final Quest quest;
/**
* The invalid stage number that was attempted to be set.
*/
private final int stage;
/**
* Create a new instance of the InvalidStageException class with the given
* holding Quest and invalid stage number.
* Create a new instance of this class with the afflicted quest and stage number.
*
* @param quest
* The quest that an invalid stage id was set within.
* @param stage
* The invalid stage id that was set.
* @param quest The quest that an invalid stage id was set within.
* @param stage The invalid stage id that was set.
*/
public InvalidStageException(Quest quest, int stage) {
this.quest = quest;
@ -68,8 +41,7 @@ public class InvalidStageException extends Exception {
}
/**
* Get the invalid stage id that was attempted to be set within the quest
* class.
* Get the invalid stage id that was attempted to be set within the quest class.
*
* @return The invalid stage id that was set.
*/

View File

@ -0,0 +1,37 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.exceptions;
public class QuestFormatException extends Exception {
private static final long serialVersionUID = -5960613170308750149L;
private final String quest;
/**
* Create a new instance of this class with the afflicted.
*
* @param quest The quest that an invalid value was set within.
*/
public QuestFormatException(String quest) {
this.quest = quest;
}
/**
* Get the quest ID associated with this exception.
*
* @return The quest that an invalid value was set within.
*/
public String getQuestId() {
return quest;
}
}

View File

@ -0,0 +1,51 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.exceptions;
import me.blackvein.quests.Quest;
public class StageFormatException extends Exception {
private static final long serialVersionUID = -8217391053042612896L;
private final Quest quest;
private final int stage;
/**
* Create a new instance of this class with the afflicted quest and stage number.
*
* @param quest The quest that an invalid stage id was set within.
* @param stage The invalid stage id that was set.
*/
public StageFormatException(Quest quest, int stage) {
this.quest = quest;
this.stage = stage;
}
/**
* Get the quest instance associated with this exception.
*
* @return The quest that an invalid stage id was set within.
*/
public Quest getQuest() {
return quest;
}
/**
* Get the invalid stage id that was attempted to be set within the quest class.
*
* @return The invalid stage id that was set.
*/
public int getStage() {
return stage;
}
}