Skip to content

Commit

Permalink
NVSHAS-9721: UI should pop up appropriate error message when user inp…
Browse files Browse the repository at this point in the history
…ut wrong registry name

correct custom exception from e.reason to e.response.enttiy of exceptionHandler
  • Loading branch information
NickChungSUSE authored and xingzhang-suse committed Dec 20, 2024
1 parent 5534b37 commit f8066af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions admin/src/main/scala/com/neu/api/Api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ trait Api extends Directives with CoreActors with Core {
complete(
HttpResponse(
status = e.statusCode,
entity = HttpEntity(
e.response.entity.contentType.asInstanceOf[ContentType.NonBinary],
e.reason
)
entity = e.response.entity
)
)
case e: Exception =>
Expand Down
3 changes: 2 additions & 1 deletion admin/src/main/scala/com/neu/core/ClientSslConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.HttpsConnectionContext
import org.apache.pekko.http.scaladsl.model.*
import org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettings
import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal
import org.apache.pekko.stream.Materializer
import org.apache.pekko.stream.scaladsl.Sink
import org.apache.pekko.stream.scaladsl.Source
Expand Down Expand Up @@ -83,7 +84,7 @@ trait ClientSslConfig extends LazyLogging {
Future.successful(response)
case status =>
logger.info(
s"Received Response - Failure\nStatusCode: ${status.intValue()} Reason: ${status.reason()}\n$response"
s"Received Response - Failure\nStatusCode: ${status.intValue()} Reason: ${status.reason()}\n Exception: ${Unmarshal(response.entity).to[String]}"
)
Future.failed(HttpResponseException(status.intValue(), status.reason(), response))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { TranslateService } from '@ngx-translate/core';
import { UtilsService } from '@common/utils/app.utils';
import { finalize } from 'rxjs/operators';
import { saveAs } from 'file-saver';
import { GlobalConstant } from '@common/constants/global.constant';
import { NotificationService } from '@services/notification.service';
import { ErrorResponse } from '@common/types';
import * as moment from 'moment';

@Component({
Expand Down

0 comments on commit f8066af

Please sign in to comment.