-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PAGOPA-2686] opex: Add error-codes #11
base: main
Are you sure you want to change the base?
Changes from all commits
6cb3736
55b7d7c
ac178dc
7e3120b
06138e5
e2c2eb1
8884901
d9aca3d
44954f3
8e8aa28
91476b6
639bcdd
4a65993
7ec23f5
d18e54f
53585ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,8 @@ | |||||
import java.time.LocalDateTime; | ||||||
import java.time.format.DateTimeFormatter; | ||||||
import java.util.Map; | ||||||
|
||||||
import it.gov.pagopa.fdr.to.eventhub.util.ErrorCodes; | ||||||
import lombok.Getter; | ||||||
|
||||||
public class BlobProcessingFunction { | ||||||
|
@@ -74,7 +76,7 @@ public synchronized void processFDR1BlobFiles( | |||||
|
||||||
context | ||||||
.getLogger() | ||||||
.info( | ||||||
.fine( | ||||||
() -> | ||||||
String.format( | ||||||
"[FDR1] Triggered at: %s for Blob container: %s, name: %s, size in bytes: %d", | ||||||
|
@@ -117,7 +119,7 @@ public synchronized void processFDR1BlobFiles( | |||||
|
||||||
context | ||||||
.getLogger() | ||||||
.info( | ||||||
.fine( | ||||||
() -> | ||||||
String.format( | ||||||
"[FDR1] Execution Finished at: %s for Blob container: %s, name: %s, size in" | ||||||
|
@@ -134,8 +136,8 @@ public synchronized void processFDR1BlobFiles( | |||||
.severe( | ||||||
() -> | ||||||
String.format( | ||||||
"[FDR1] Error processing Blob '%s/%s': %s", | ||||||
fdr1Container, blobName, e.getMessage())); | ||||||
"[%s][FDR1] Error processing Blob '%s/%s': %s", | ||||||
ErrorCodes.FDR1_E1, fdr1Container, blobName, e.getMessage())); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [google-java-format] reported by reviewdog 🐶
Suggested change
|
||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -153,15 +155,15 @@ public void processFDR3BlobFiles( | |||||
|
||||||
context | ||||||
.getLogger() | ||||||
.info( | ||||||
.fine( | ||||||
() -> | ||||||
String.format( | ||||||
"[FDR3] Triggered for Blob container: %s, name: %s, size: %d bytes", | ||||||
fdr3Container, blobName, content.length)); | ||||||
|
||||||
context | ||||||
.getLogger() | ||||||
.info( | ||||||
.fine( | ||||||
() -> | ||||||
String.format( | ||||||
"[FDR3] Execution Finished at: %s for Blob container: %s, name: %s, size: %d" | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -164,8 +164,8 @@ public static boolean processXmlBlobAndSendToEventHub( | |||||||||
// Log the exception with context | ||||||||||
String errorMessage = | ||||||||||
String.format( | ||||||||||
"Error processing or sending data to event hub: %s. Details: %s", | ||||||||||
flussoRendicontazione.getIdentificativoFlusso(), e.getMessage()); | ||||||||||
"[%s] Error processing or sending data to event hub: %s. Details: %s", | ||||||||||
ErrorCodes.COMMON_E2, flussoRendicontazione.getIdentificativoFlusso(), e.getMessage()); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [google-java-format] reported by reviewdog 🐶
Suggested change
|
||||||||||
context.getLogger().severe(() -> errorMessage); | ||||||||||
|
||||||||||
return false; | ||||||||||
|
@@ -241,11 +241,11 @@ private boolean sendEventToHub( | |||||||||
} catch (Exception e) { | ||||||||||
context | ||||||||||
.getLogger() | ||||||||||
.warning( | ||||||||||
.severe( | ||||||||||
() -> | ||||||||||
String.format( | ||||||||||
"Failed to add event to batch for flow ID: %s. Details: %s", | ||||||||||
flusso.getIdentificativoFlusso(), e.getMessage())); | ||||||||||
"[%s] Failed to add event to batch for flow ID: %s. Details: %s", | ||||||||||
ErrorCodes.COMMON_E1, flusso.getIdentificativoFlusso(), e.getMessage())); | ||||||||||
return false; | ||||||||||
} | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||||||||||||||
package it.gov.pagopa.fdr.to.eventhub.util; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
import lombok.Getter; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
@Getter | ||||||||||||||||||||||||
public enum ErrorCodes { | ||||||||||||||||||||||||
// Common Errors | ||||||||||||||||||||||||
COMMON_E1("FDR-E1", "Error while sending to EventHub."), | ||||||||||||||||||||||||
COMMON_E2("FDR-E2", "Error while process XML Blob."), | ||||||||||||||||||||||||
// FDR1 Errors | ||||||||||||||||||||||||
FDR1_E1("FDR1-E1", "Error processing Blob in processFDR1BlobFiles function"); | ||||||||||||||||||||||||
Comment on lines
+7
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [google-java-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [google-java-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||
private final String code; | ||||||||||||||||||||||||
private final String message; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
ErrorCodes(String code, String message) { | ||||||||||||||||||||||||
this.code = code; | ||||||||||||||||||||||||
this.message = message; | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
Comment on lines
+14
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [google-java-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[google-java-format] reported by reviewdog 🐶