Skip to content

Commit

Permalink
feat: Error showcase length update and rethrow error from the package #…
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 17, 2023
1 parent ae9d1c6 commit 2d165cc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 51 deletions.
91 changes: 47 additions & 44 deletions lib/app/shared/widget/dialog/error_details_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,54 +35,57 @@ class ErrorDetailsDialog extends StatelessWidget {
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(25)),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 25),
if (erroDescription != null) ...[
Text(
erroDescription!,
style: Theme.of(context)
.textTheme
.defaultDialogSubtitle
.copyWith(color: textColor),
textAlign: TextAlign.center,
),
],
if (erroUrl != null) ...[
const SizedBox(height: Sizes.spaceXSmall),
TransparentInkWell(
onTap: () async {
await LaunchUrl.launch(
erroUrl!,
launchMode: LaunchMode.inAppWebView,
);
},
child: Text(
l10n.moreDetails,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.markDownA,
decoration: TextDecoration.underline,
decorationColor: Theme.of(context).colorScheme.markDownA,
),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 25),
if (erroDescription != null) ...[
Text(
erroDescription!,
style: Theme.of(context)
.textTheme
.defaultDialogSubtitle
.copyWith(color: textColor),
textAlign: TextAlign.center,
),
],
if (erroUrl != null) ...[
const SizedBox(height: Sizes.spaceXSmall),
TransparentInkWell(
onTap: () async {
await LaunchUrl.launch(
erroUrl!,
launchMode: LaunchMode.inAppWebView,
);
},
child: Text(
l10n.moreDetails,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.markDownA,
decoration: TextDecoration.underline,
decorationColor:
Theme.of(context).colorScheme.markDownA,
),
textAlign: TextAlign.center,
),
),
],
const SizedBox(height: 24),
MyElevatedButton(
text: l10n.ok,
verticalSpacing: 14,
backgroundColor: color,
borderRadius: Sizes.smallRadius,
fontSize: 15,
elevation: 0,
onPressed: () {
Navigator.of(context).pop(true);
},
),
const SizedBox(height: 15),
],
const SizedBox(height: 24),
MyElevatedButton(
text: l10n.ok,
verticalSpacing: 14,
backgroundColor: color,
borderRadius: Sizes.smallRadius,
fontSize: 15,
elevation: 0,
onPressed: () {
Navigator.of(context).pop(true);
},
),
const SizedBox(height: 15),
],
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ Future<Map<String, dynamic>> getOpenIdConfigSecondAttempt({
: response.data as Map<String, dynamic>;
return data;
} catch (e) {
throw Exception();
throw Exception('Second_Attempt_Fail');
}
}
12 changes: 6 additions & 6 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class OIDC4VC {
);
return didDocument;
} catch (e) {
throw Exception(e);
rethrow;
}
}

Expand Down Expand Up @@ -779,7 +779,7 @@ class OIDC4VC {

return vpToken;
} catch (e) {
throw Exception(e);
rethrow;
}
}

Expand Down Expand Up @@ -809,7 +809,7 @@ class OIDC4VC {

return verifierIdToken;
} catch (e) {
throw Exception(e);
rethrow;
}
}

Expand Down Expand Up @@ -865,7 +865,7 @@ class OIDC4VC {
);
return response;
} catch (e) {
throw Exception(e);
rethrow;
}
}

Expand Down Expand Up @@ -1028,7 +1028,7 @@ class OIDC4VC {
return data;
} catch (e) {
if (e.toString().startsWith('Exception: Second_Attempt_Fail')) {
throw Exception();
rethrow;
} else {
final data = await getOpenIdConfigSecondAttempt(baseUrl);
return data;
Expand All @@ -1048,7 +1048,7 @@ class OIDC4VC {
: response.data as Map<String, dynamic>;
return data;
} catch (e) {
throw Exception();
throw Exception('Second_Attempt_Fail');
}
}
}

0 comments on commit 2d165cc

Please sign in to comment.