mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
explicityly print the internal error from DispatchError
This commit is contained in:
parent
18d13a3cb2
commit
4c93b04f3d
@ -43,12 +43,12 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {
|
||||
|
||||
SignInState stateFromCode(UserError error) {
|
||||
switch (error.code) {
|
||||
case UserErrCode.EmailFormatInvalid:
|
||||
case ErrorCode.EmailFormatInvalid:
|
||||
return state.copyWith(
|
||||
isSubmitting: false,
|
||||
emailError: some(error.msg),
|
||||
passwordError: none());
|
||||
case UserErrCode.PasswordFormatInvalid:
|
||||
case ErrorCode.PasswordFormatInvalid:
|
||||
return state.copyWith(
|
||||
isSubmitting: false,
|
||||
passwordError: some(error.msg),
|
||||
|
@ -10,7 +10,7 @@ import 'package:flowy_infra/time/duration.dart';
|
||||
import 'package:flowy_infra_ui/widget/route/animation.dart';
|
||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart' as workspace;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@ -43,7 +43,7 @@ class WelcomeRoute implements IWelcomeRoute {
|
||||
(workspace) =>
|
||||
_pushToScreen(context, HomeScreen(repo.user, workspace.id)),
|
||||
(error) async {
|
||||
assert(error.code == WsErrCode.CurrentWorkspaceNotFound);
|
||||
assert(error.code == workspace.ErrorCode.CurrentWorkspaceNotFound);
|
||||
final screen = WorkspaceSelectScreen(repo: repo);
|
||||
final workspaceId = await Navigator.of(context).push(
|
||||
PageRoutes.fade(
|
||||
|
@ -7,7 +7,6 @@ import 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';
|
||||
export 'package:flowy_sdk/protobuf/flowy-workspace/workspace_create.pb.dart';
|
||||
export 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart';
|
||||
export 'package:flowy_sdk/protobuf/flowy-user/user_detail.pb.dart';
|
||||
export 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
|
||||
typedef UserCreateWorkspaceCallback = void Function(
|
||||
Either<List<Workspace>, WorkspaceError> workspacesOrFailed);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';
|
||||
import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart' as workspace;
|
||||
import 'package:app_flowy/workspace/domain/i_app.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
||||
export 'package:app_flowy/workspace/domain/i_app.dart';
|
||||
@ -13,12 +13,12 @@ class IAppImpl extends IApp {
|
||||
});
|
||||
|
||||
@override
|
||||
Future<Either<List<View>, WorkspaceError>> getViews() {
|
||||
Future<Either<List<View>, workspace.WorkspaceError>> getViews() {
|
||||
return repo.getViews();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<View, WorkspaceError>> createView(
|
||||
Future<Either<View, workspace.WorkspaceError>> createView(
|
||||
{required String name, String? desc, required ViewType viewType}) {
|
||||
return repo.createView(name, desc ?? "", viewType).then((result) {
|
||||
return result.fold(
|
||||
@ -28,14 +28,15 @@ class IAppImpl extends IApp {
|
||||
});
|
||||
}
|
||||
|
||||
Future<Either<View, WorkspaceError>> _createDoc(View view) async {
|
||||
Future<Either<View, workspace.WorkspaceError>> _createDoc(View view) async {
|
||||
switch (view.viewType) {
|
||||
case ViewType.Doc:
|
||||
final docRepo = DocRepository(docId: view.id);
|
||||
final result = await docRepo.createDoc(
|
||||
name: view.name, desc: "", text: "[{\"insert\":\"\\n\"}]");
|
||||
return result.fold((l) => left(view), (r) {
|
||||
return right(WorkspaceError(code: WsErrCode.Unknown, msg: r.msg));
|
||||
return right(workspace.WorkspaceError(
|
||||
code: workspace.ErrorCode.Unknown, msg: r.msg));
|
||||
});
|
||||
default:
|
||||
return left(view);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:app_flowy/workspace/domain/i_user.dart';
|
||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||
export 'package:app_flowy/workspace/domain/i_user.dart';
|
||||
export 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
||||
|
||||
|
@ -17,7 +17,7 @@ import 'package:flowy_sdk/protobuf/flowy-document/protobuf.dart';
|
||||
// ignore: unused_import
|
||||
import 'package:flowy_sdk/protobuf/flowy-infra/protobuf.dart';
|
||||
import 'package:protobuf/protobuf.dart';
|
||||
// import 'dart:convert' show utf8;
|
||||
import 'dart:convert' show utf8;
|
||||
import 'error.dart';
|
||||
|
||||
part 'code_gen.dart';
|
||||
@ -51,12 +51,18 @@ Future<Either<Uint8List, Uint8List>> _extractPayload(
|
||||
return responseFuture.then((result) {
|
||||
return result.fold(
|
||||
(response) {
|
||||
if (response.code == FFIStatusCode.Ok) {
|
||||
return left(Uint8List.fromList(response.payload));
|
||||
} else {
|
||||
// final error = utf8.decode(response.payload);
|
||||
// Log.error("Dispatch error: $error");
|
||||
return right(Uint8List.fromList(response.payload));
|
||||
switch (response.code) {
|
||||
case FFIStatusCode.Ok:
|
||||
return left(Uint8List.fromList(response.payload));
|
||||
case FFIStatusCode.Err:
|
||||
return right(Uint8List.fromList(response.payload));
|
||||
case FFIStatusCode.Internal:
|
||||
final error = utf8.decode(response.payload);
|
||||
Log.error("Dispatch internal error: $error");
|
||||
return right(emptyBytes());
|
||||
default:
|
||||
Log.error("Impossible to here");
|
||||
return right(emptyBytes());
|
||||
}
|
||||
},
|
||||
(error) {
|
||||
|
@ -16,7 +16,7 @@ export 'ffi_response.pbenum.dart';
|
||||
class FFIResponse extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FFIResponse', createEmptyInstance: create)
|
||||
..a<$core.List<$core.int>>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'payload', $pb.PbFieldType.OY)
|
||||
..e<FFIStatusCode>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'code', $pb.PbFieldType.OE, defaultOrMaker: FFIStatusCode.Unknown, valueOf: FFIStatusCode.valueOf, enumValues: FFIStatusCode.values)
|
||||
..e<FFIStatusCode>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'code', $pb.PbFieldType.OE, defaultOrMaker: FFIStatusCode.Ok, valueOf: FFIStatusCode.valueOf, enumValues: FFIStatusCode.values)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
|
@ -10,14 +10,14 @@ import 'dart:core' as $core;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class FFIStatusCode extends $pb.ProtobufEnum {
|
||||
static const FFIStatusCode Unknown = FFIStatusCode._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Unknown');
|
||||
static const FFIStatusCode Ok = FFIStatusCode._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Ok');
|
||||
static const FFIStatusCode Err = FFIStatusCode._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Err');
|
||||
static const FFIStatusCode Ok = FFIStatusCode._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Ok');
|
||||
static const FFIStatusCode Err = FFIStatusCode._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Err');
|
||||
static const FFIStatusCode Internal = FFIStatusCode._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Internal');
|
||||
|
||||
static const $core.List<FFIStatusCode> values = <FFIStatusCode> [
|
||||
Unknown,
|
||||
Ok,
|
||||
Err,
|
||||
Internal,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, FFIStatusCode> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
|
@ -12,14 +12,14 @@ import 'dart:typed_data' as $typed_data;
|
||||
const FFIStatusCode$json = const {
|
||||
'1': 'FFIStatusCode',
|
||||
'2': const [
|
||||
const {'1': 'Unknown', '2': 0},
|
||||
const {'1': 'Ok', '2': 1},
|
||||
const {'1': 'Err', '2': 2},
|
||||
const {'1': 'Ok', '2': 0},
|
||||
const {'1': 'Err', '2': 1},
|
||||
const {'1': 'Internal', '2': 2},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `FFIStatusCode`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List fFIStatusCodeDescriptor = $convert.base64Decode('Cg1GRklTdGF0dXNDb2RlEgsKB1Vua25vd24QABIGCgJPaxABEgcKA0VychAC');
|
||||
final $typed_data.Uint8List fFIStatusCodeDescriptor = $convert.base64Decode('Cg1GRklTdGF0dXNDb2RlEgYKAk9rEAASBwoDRXJyEAESDAoISW50ZXJuYWwQAg==');
|
||||
@$core.Deprecated('Use fFIResponseDescriptor instead')
|
||||
const FFIResponse$json = const {
|
||||
'1': 'FFIResponse',
|
||||
|
@ -3,13 +3,13 @@ use flowy_dispatch::prelude::{EventResponse, Payload, StatusCode};
|
||||
|
||||
#[derive(ProtoBuf_Enum, Clone, Copy)]
|
||||
pub enum FFIStatusCode {
|
||||
Unknown = 0,
|
||||
Ok = 1,
|
||||
Err = 2,
|
||||
Ok = 0,
|
||||
Err = 1,
|
||||
Internal = 2,
|
||||
}
|
||||
|
||||
impl std::default::Default for FFIStatusCode {
|
||||
fn default() -> FFIStatusCode { FFIStatusCode::Unknown }
|
||||
fn default() -> FFIStatusCode { FFIStatusCode::Ok }
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default)]
|
||||
@ -31,6 +31,7 @@ impl std::convert::From<EventResponse> for FFIResponse {
|
||||
let code = match resp.status_code {
|
||||
StatusCode::Ok => FFIStatusCode::Ok,
|
||||
StatusCode::Err => FFIStatusCode::Err,
|
||||
StatusCode::Internal => FFIStatusCode::Internal,
|
||||
};
|
||||
|
||||
// let msg = match resp.error {
|
||||
|
@ -77,7 +77,7 @@ impl FFIResponse {
|
||||
self.code
|
||||
}
|
||||
pub fn clear_code(&mut self) {
|
||||
self.code = FFIStatusCode::Unknown;
|
||||
self.code = FFIStatusCode::Ok;
|
||||
}
|
||||
|
||||
// Param is passed by value, moved
|
||||
@ -116,7 +116,7 @@ impl ::protobuf::Message for FFIResponse {
|
||||
if !self.payload.is_empty() {
|
||||
my_size += ::protobuf::rt::bytes_size(1, &self.payload);
|
||||
}
|
||||
if self.code != FFIStatusCode::Unknown {
|
||||
if self.code != FFIStatusCode::Ok {
|
||||
my_size += ::protobuf::rt::enum_size(2, self.code);
|
||||
}
|
||||
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
|
||||
@ -128,7 +128,7 @@ impl ::protobuf::Message for FFIResponse {
|
||||
if !self.payload.is_empty() {
|
||||
os.write_bytes(1, &self.payload)?;
|
||||
}
|
||||
if self.code != FFIStatusCode::Unknown {
|
||||
if self.code != FFIStatusCode::Ok {
|
||||
os.write_enum(2, ::protobuf::ProtobufEnum::value(&self.code))?;
|
||||
}
|
||||
os.write_unknown_fields(self.get_unknown_fields())?;
|
||||
@ -196,7 +196,7 @@ impl ::protobuf::Message for FFIResponse {
|
||||
impl ::protobuf::Clear for FFIResponse {
|
||||
fn clear(&mut self) {
|
||||
self.payload.clear();
|
||||
self.code = FFIStatusCode::Unknown;
|
||||
self.code = FFIStatusCode::Ok;
|
||||
self.unknown_fields.clear();
|
||||
}
|
||||
}
|
||||
@ -215,9 +215,9 @@ impl ::protobuf::reflect::ProtobufValue for FFIResponse {
|
||||
|
||||
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
|
||||
pub enum FFIStatusCode {
|
||||
Unknown = 0,
|
||||
Ok = 1,
|
||||
Err = 2,
|
||||
Ok = 0,
|
||||
Err = 1,
|
||||
Internal = 2,
|
||||
}
|
||||
|
||||
impl ::protobuf::ProtobufEnum for FFIStatusCode {
|
||||
@ -227,18 +227,18 @@ impl ::protobuf::ProtobufEnum for FFIStatusCode {
|
||||
|
||||
fn from_i32(value: i32) -> ::std::option::Option<FFIStatusCode> {
|
||||
match value {
|
||||
0 => ::std::option::Option::Some(FFIStatusCode::Unknown),
|
||||
1 => ::std::option::Option::Some(FFIStatusCode::Ok),
|
||||
2 => ::std::option::Option::Some(FFIStatusCode::Err),
|
||||
0 => ::std::option::Option::Some(FFIStatusCode::Ok),
|
||||
1 => ::std::option::Option::Some(FFIStatusCode::Err),
|
||||
2 => ::std::option::Option::Some(FFIStatusCode::Internal),
|
||||
_ => ::std::option::Option::None
|
||||
}
|
||||
}
|
||||
|
||||
fn values() -> &'static [Self] {
|
||||
static values: &'static [FFIStatusCode] = &[
|
||||
FFIStatusCode::Unknown,
|
||||
FFIStatusCode::Ok,
|
||||
FFIStatusCode::Err,
|
||||
FFIStatusCode::Internal,
|
||||
];
|
||||
values
|
||||
}
|
||||
@ -256,7 +256,7 @@ impl ::std::marker::Copy for FFIStatusCode {
|
||||
|
||||
impl ::std::default::Default for FFIStatusCode {
|
||||
fn default() -> Self {
|
||||
FFIStatusCode::Unknown
|
||||
FFIStatusCode::Ok
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,23 +269,23 @@ impl ::protobuf::reflect::ProtobufValue for FFIStatusCode {
|
||||
static file_descriptor_proto_data: &'static [u8] = b"\
|
||||
\n\x12ffi_response.proto\"K\n\x0bFFIResponse\x12\x18\n\x07payload\x18\
|
||||
\x01\x20\x01(\x0cR\x07payload\x12\"\n\x04code\x18\x02\x20\x01(\x0e2\x0e.\
|
||||
FFIStatusCodeR\x04code*-\n\rFFIStatusCode\x12\x0b\n\x07Unknown\x10\0\x12\
|
||||
\x06\n\x02Ok\x10\x01\x12\x07\n\x03Err\x10\x02J\xab\x02\n\x06\x12\x04\0\0\
|
||||
\n\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\
|
||||
\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x13\n\x0b\n\x04\x04\0\x02\0\x12\
|
||||
\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\t\n\x0c\n\
|
||||
\x05\x04\0\x02\0\x01\x12\x03\x03\n\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\
|
||||
FFIStatusCodeR\x04code*.\n\rFFIStatusCode\x12\x06\n\x02Ok\x10\0\x12\x07\
|
||||
\n\x03Err\x10\x01\x12\x0c\n\x08Internal\x10\x02J\xab\x02\n\x06\x12\x04\0\
|
||||
\0\n\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\
|
||||
\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\x02\x08\x13\n\x0b\n\x04\x04\0\x02\0\
|
||||
\x12\x03\x03\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\t\n\x0c\
|
||||
\n\x05\x04\0\x02\0\x01\x12\x03\x03\n\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\
|
||||
\x03\x03\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x1b\n\x0c\n\
|
||||
\x05\x04\0\x02\x01\x06\x12\x03\x04\x04\x11\n\x0c\n\x05\x04\0\x02\x01\x01\
|
||||
\x12\x03\x04\x12\x16\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x19\x1a\n\
|
||||
\n\n\x02\x05\0\x12\x04\x06\0\n\x01\n\n\n\x03\x05\0\x01\x12\x03\x06\x05\
|
||||
\x12\n\x0b\n\x04\x05\0\x02\0\x12\x03\x07\x04\x10\n\x0c\n\x05\x05\0\x02\0\
|
||||
\x01\x12\x03\x07\x04\x0b\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x07\x0e\x0f\
|
||||
\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x08\x04\x0b\n\x0c\n\x05\x05\0\x02\x01\
|
||||
\x01\x12\x03\x08\x04\x06\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x08\t\n\n\
|
||||
\x0b\n\x04\x05\0\x02\x02\x12\x03\t\x04\x0c\n\x0c\n\x05\x05\0\x02\x02\x01\
|
||||
\x12\x03\t\x04\x07\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\t\n\x0bb\x06pro\
|
||||
to3\
|
||||
\x12\n\x0b\n\x04\x05\0\x02\0\x12\x03\x07\x04\x0b\n\x0c\n\x05\x05\0\x02\0\
|
||||
\x01\x12\x03\x07\x04\x06\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x07\t\n\n\
|
||||
\x0b\n\x04\x05\0\x02\x01\x12\x03\x08\x04\x0c\n\x0c\n\x05\x05\0\x02\x01\
|
||||
\x01\x12\x03\x08\x04\x07\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x08\n\x0b\
|
||||
\n\x0b\n\x04\x05\0\x02\x02\x12\x03\t\x04\x11\n\x0c\n\x05\x05\0\x02\x02\
|
||||
\x01\x12\x03\t\x04\x0c\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\t\x0f\x10b\
|
||||
\x06proto3\
|
||||
";
|
||||
|
||||
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;
|
||||
|
@ -5,7 +5,7 @@ message FFIResponse {
|
||||
FFIStatusCode code = 2;
|
||||
}
|
||||
enum FFIStatusCode {
|
||||
Unknown = 0;
|
||||
Ok = 1;
|
||||
Err = 2;
|
||||
Ok = 0;
|
||||
Err = 1;
|
||||
Internal = 2;
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ pub fn category_from_str(type_str: &str) -> TypeCategory {
|
||||
| "FFIStatusCode"
|
||||
| "UserStatus"
|
||||
| "UserEvent"
|
||||
| "ErrorCode"
|
||||
=> TypeCategory::Enum,
|
||||
|
||||
"Option" => TypeCategory::Opt,
|
||||
|
@ -114,7 +114,7 @@ impl fmt::Display for InternalError {
|
||||
impl Error for InternalError {
|
||||
fn as_response(&self) -> EventResponse {
|
||||
let error = format!("{}", self).into_bytes();
|
||||
ResponseBuilder::Err().data(error).build()
|
||||
ResponseBuilder::Internal().data(error).build()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,5 @@ impl ResponseBuilder {
|
||||
|
||||
static_response!(Ok, StatusCode::Ok);
|
||||
static_response!(Err, StatusCode::Err);
|
||||
static_response!(Internal, StatusCode::Internal);
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ use std::{convert::TryFrom, fmt, fmt::Formatter};
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
|
||||
pub enum StatusCode {
|
||||
Ok = 0,
|
||||
Err = 1,
|
||||
Ok = 0,
|
||||
Err = 1,
|
||||
Internal = 2,
|
||||
}
|
||||
|
||||
// serde user guide: https://serde.rs/field-attrs.html
|
||||
@ -35,12 +36,15 @@ impl EventResponse {
|
||||
T: FromBytes,
|
||||
E: FromBytes,
|
||||
{
|
||||
if self.status_code == StatusCode::Err {
|
||||
let err = <Data<E>>::try_from(self.payload)?;
|
||||
Ok(Err(err.into_inner()))
|
||||
} else {
|
||||
let data = <Data<T>>::try_from(self.payload)?;
|
||||
Ok(Ok(data.into_inner()))
|
||||
match self.status_code {
|
||||
StatusCode::Ok => {
|
||||
let data = <Data<T>>::try_from(self.payload)?;
|
||||
Ok(Ok(data.into_inner()))
|
||||
},
|
||||
StatusCode::Err | StatusCode::Internal => {
|
||||
let err = <Data<E>>::try_from(self.payload)?;
|
||||
Ok(Err(err.into_inner()))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,4 +23,5 @@ similar = "1.2.2"
|
||||
dialoguer = "0.8.0"
|
||||
toml = "0.5.8"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
pathdiff = "0.2.0"
|
||||
pathdiff = "0.2.0"
|
||||
itertools = "0.10"
|
@ -1,5 +1,6 @@
|
||||
use crate::proto::proto_info::{CrateProtoInfo, ProtoFile};
|
||||
use crate::util::{get_tera, read_file};
|
||||
use itertools::Itertools;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use tera::Context;
|
||||
@ -13,6 +14,7 @@ pub struct ProtobufDeriveMeta {
|
||||
#[allow(dead_code)]
|
||||
impl ProtobufDeriveMeta {
|
||||
pub fn new(structs: Vec<String>, enums: Vec<String>) -> Self {
|
||||
let enums: Vec<_> = enums.into_iter().unique().collect();
|
||||
return ProtobufDeriveMeta {
|
||||
context: Context::new(),
|
||||
structs,
|
||||
|
Loading…
Reference in New Issue
Block a user