Skip to content

Commit 6c24e3a

Browse files
dragonpooludomikula
authored andcommitted
Add not found exception
1 parent a693103 commit 6c24e3a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Diff for: server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/exception/BizError.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ public enum BizError {
158158
SLUG_INVALID(403, 6502),
159159

160160
//flow 6601 - 6601
161-
FLOW_ERROR(500, 6601);
161+
FLOW_ERROR(500, 6601),
162+
163+
//organization related 6701 - 6701
164+
ORGANIZATION_NOT_FOUND(400, 6701);
162165

163166
static {
164167
checkDuplicates(values(), BizError::getBizErrorCode);

Diff for: server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,5 @@ DUPLICATE_AUTH_CONFIG_ADDITION=Provider auth type already added to organization
285285
EMAIL_PROVIDER_DISABLED=Email provider is disabled.
286286
SLUG_DUPLICATE_ENTRY=Slug already exists
287287
SLUG_INVALID=Slug format is invalid
288-
FLOW_ERROR=Flow error message: {0}
288+
FLOW_ERROR=Flow error message: {0}
289+
ORGANIZATION_NOT_FOUND=Organization not found.

Diff for: server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/usermanagement/OrganizationController.java

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.lowcoder.domain.user.service.UserService;
2222
import org.lowcoder.sdk.config.CommonConfig;
2323
import org.lowcoder.sdk.constants.WorkspaceMode;
24+
import org.lowcoder.sdk.exception.BizError;
25+
import org.lowcoder.sdk.exception.BizException;
2426
import org.springframework.beans.factory.annotation.Autowired;
2527
import org.springframework.http.codec.multipart.Part;
2628
import org.springframework.web.bind.annotation.*;
@@ -186,6 +188,7 @@ public Mono<ResponseView<Organization>> updateSlug(@PathVariable String orgId, @
186188
public Mono<ResponseView<Organization>> getOrganization(@PathVariable String orgId) {
187189
return gidService.convertOrganizationIdToObjectId(orgId)
188190
.flatMap(id -> organizationService.getById(id))
191+
.switchIfEmpty(Mono.error(new BizException(BizError.ORGANIZATION_NOT_FOUND, "ORGANIZATION_NOT_FOUND")))
189192
.map(ResponseView::success);
190193
}
191194

0 commit comments

Comments
 (0)