Skip to content

Commit 721f4d7

Browse files
committed
feature: [172] Update exception handling
1 parent c285046 commit 721f4d7

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

acl-mug-dsl/src/main/java/javasabr/mqtt/acl/mug/dsl/loader/AclRulesLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public Map<Operation, Array<AclRule>> load(InputStream aclConfigInputStream) {
2222
try {
2323
content = new InputStreamReader(aclConfigInputStream).readAllAsString();
2424
} catch (Exception e) {
25-
throw new AclConfigurationException("Failed to read ACL file:[%s]".formatted(aclConfigInputStream), e);
25+
throw new AclConfigurationException("Failed to read ACL input stream", e);
2626
}
2727
Array<AclRule> rules = new ArrayBuilder<>(AclRule.class)
2828
.add(parser.parse(content))

acl-service/src/main/java/javasabr/mqtt/acl/service/impl/UriLoaderAuthorizationService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package javasabr.mqtt.acl.service.impl;
22

3-
import java.io.IOException;
43
import java.io.InputStream;
54
import java.net.URI;
65
import java.util.Map;
@@ -29,8 +28,8 @@ public void loadFrom(URI resource) {
2928
Map<Operation, Array<AclRule>> aclRulesMap = rulesLoader.apply(aclInputStream);
3029
switchTo(new AclEngine(aclRulesMap));
3130
log.info(resource, aclRulesMap, UriLoaderAuthorizationService::buildServiceDescription);
32-
} catch (IOException e) {
33-
throw new AclConfigurationException("ACL configuration issue:[%s]".formatted(resource), e);
31+
} catch (Exception e) {
32+
throw new AclConfigurationException("Unable to load ACL configuration:[%s]".formatted(resource), e);
3433
}
3534
}
3635

credentials-source-file/src/main/java/javasabr/mqtt/auth/credentials/source/FileCredentialsSource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package javasabr.mqtt.auth.credentials.source;
22

33
import com.fasterxml.jackson.annotation.JsonValue;
4-
import java.io.IOException;
54
import java.io.InputStream;
65
import java.net.URI;
76
import java.util.Map;
@@ -25,8 +24,8 @@ public FileCredentialsSource(URI fileName) {
2524
private void init() {
2625
try (InputStream aclInputStream = ClassPathResourceResolver.newInputStream(fileName)) {
2726
reset(aclInputStream);
28-
} catch (IOException e) {
29-
throw new CredentialsSourceException("Error during credentials file read", e);
27+
} catch (Exception e) {
28+
throw new CredentialsSourceException("Unable to reset credentials file:[%s]".formatted(fileName), e);
3029
}
3130
}
3231

0 commit comments

Comments
 (0)