Skip to content

Commit

Permalink
W-16354625: Added required exceptions for each operation
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitg-1 committed Aug 6, 2024
1 parent fc358bb commit 1f4ba58
Show file tree
Hide file tree
Showing 14 changed files with 524 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

public enum MuleChainErrorType implements ErrorTypeDefinition<MuleChainErrorType> {

INVALID_AUTHENTICATION, IO_EXCEPTION, TIME_OUT, RATE_LIMIT_OR_QUOTA_EXCEEDED;
MODEL_CREATION_FAILED, AI_SERVICES_FAILURE, IMAGE_ANALYSIS_FAILURE, IMAGE_GENERATION_FAILURE, IMAGE_PROCESSING_FAILURE, FILE_HANDLING_FAILURE, RAG_FAILURE, EMBEDDING_OPERATIONS_FAILURE, TOOLS_OPERATION_FAILURE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class ChatException extends ModuleException {

public ChatException(String message, Exception exception) {
super(message, MuleChainErrorType.AI_SERVICES_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.mule.extension.mulechain.internal.exception;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class FileHandlingException extends ModuleException {

public FileHandlingException(String message, Exception exception) {
super(message, MuleChainErrorType.FILE_HANDLING_FAILURE, exception);
}

public FileHandlingException(String message) {
super(message, MuleChainErrorType.FILE_HANDLING_FAILURE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class PromptTemplateException extends ModuleException {

public PromptTemplateException(String message, Exception exception) {
super(message, MuleChainErrorType.AI_SERVICES_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class SentimentAnalyzerException extends ModuleException {

public SentimentAnalyzerException(String message, Exception exception) {
super(message, MuleChainErrorType.AI_SERVICES_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.embedding;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class EmbeddingStoreOperationsException extends ModuleException {

public EmbeddingStoreOperationsException(String message, Exception exception) {
super(message, MuleChainErrorType.EMBEDDING_OPERATIONS_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.embedding;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class RagException extends ModuleException {

public RagException(String message, Exception exception) {
super(message, MuleChainErrorType.RAG_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.image;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class ImageAnalyzerException extends ModuleException {

public ImageAnalyzerException(String message, Exception exception) {
super(message, MuleChainErrorType.IMAGE_ANALYSIS_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.image;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class ImageGenerationException extends ModuleException {

public ImageGenerationException(String message, Exception exception) {
super(message, MuleChainErrorType.IMAGE_GENERATION_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.image;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class ImageProcessingException extends ModuleException {

public ImageProcessingException(String message, Exception exception) {
super(message, MuleChainErrorType.IMAGE_PROCESSING_FAILURE, exception);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mule.extension.mulechain.internal.exception.tools;

import org.mule.extension.mulechain.internal.error.MuleChainErrorType;
import org.mule.runtime.extension.api.exception.ModuleException;

public class ToolsOperationException extends ModuleException {

public ToolsOperationException(String message, Exception exception) {
super(message, MuleChainErrorType.TOOLS_OPERATION_FAILURE, exception);
}
}
Loading

0 comments on commit 1f4ba58

Please sign in to comment.