Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed mutable values and loops. Added railway oriented error handling #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
</PropertyGroup>


<PropertyGroup Condition="'$(PaketPropsVersion)' != '5.174.2' ">
<PaketRestoreRequired>true</PaketRestoreRequired>
</PropertyGroup>

<!-- Do a global restore if required -->
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
Expand Down Expand Up @@ -132,11 +135,11 @@
<Error Condition=" '$(DoAllResolvedFilesExist)' != 'true' AND '$(ResolveNuGetPackages)' != 'False' " Text="One Paket file '@(PaketResolvedFilePaths)' is missing while restoring $(MSBuildProjectFile). Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />

<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
<ReadLinesFromFile Condition="'@(PaketResolvedFilePaths)' != ''" File="%(PaketResolvedFilePaths.Identity)" ><!--Condition="Exists('%(PaketResolvedFilePaths.Identity)')"-->
<ReadLinesFromFile Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketResolvedFilePaths)' != ''" File="%(PaketResolvedFilePaths.Identity)" >
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
</ReadLinesFromFile>

<ItemGroup Condition=" '@(PaketReferencesFileLines)' != '' " >
<ItemGroup Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketReferencesFileLines)' != '' " >
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
Expand Down
82 changes: 42 additions & 40 deletions src/s2client-dotnet.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "s2client-fsharp", "s2client-fsharp\s2client-fsharp.fsproj", "{1C9FB686-318F-49BA-BB2F-297863EB8745}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "s2client-fsharp", "s2client-fsharp\s2client-fsharp.fsproj", "{1C9FB686-318F-49BA-BB2F-297863EB8745}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "s2client-proto", "s2client-proto\s2client-proto.csproj", "{A353213F-13F2-40AE-BEAF-832AD0255223}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "s2client-proto", "s2client-proto\s2client-proto.csproj", "{A353213F-13F2-40AE-BEAF-832AD0255223}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "s2client-test", "s2client-test\s2client-test.fsproj", "{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "s2client-test", "s2client-test\s2client-test.fsproj", "{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "s2client-testCSharp", "s2client-testCSharp\s2client-testCSharp.csproj", "{22359A31-BC1E-4F75-860B-3A1773969F19}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "s2client-testCSharp", "s2client-testCSharp\s2client-testCSharp.csproj", "{22359A31-BC1E-4F75-860B-3A1773969F19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,57 +19,60 @@ Global
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x64.ActiveCfg = Debug|x64
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x64.Build.0 = Debug|x64
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x86.ActiveCfg = Debug|x86
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x86.Build.0 = Debug|x86
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x64.ActiveCfg = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x64.Build.0 = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x86.ActiveCfg = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Debug|x86.Build.0 = Debug|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|Any CPU.Build.0 = Release|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x64.ActiveCfg = Release|x64
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x64.Build.0 = Release|x64
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x86.ActiveCfg = Release|x86
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x86.Build.0 = Release|x86
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x64.ActiveCfg = Release|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x64.Build.0 = Release|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x86.ActiveCfg = Release|Any CPU
{1C9FB686-318F-49BA-BB2F-297863EB8745}.Release|x86.Build.0 = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x64.ActiveCfg = Debug|x64
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x64.Build.0 = Debug|x64
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x86.ActiveCfg = Debug|x86
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x86.Build.0 = Debug|x86
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x64.ActiveCfg = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x64.Build.0 = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x86.ActiveCfg = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Debug|x86.Build.0 = Debug|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|Any CPU.Build.0 = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x64.ActiveCfg = Release|x64
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x64.Build.0 = Release|x64
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x86.ActiveCfg = Release|x86
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x86.Build.0 = Release|x86
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x64.ActiveCfg = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x64.Build.0 = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x86.ActiveCfg = Release|Any CPU
{A353213F-13F2-40AE-BEAF-832AD0255223}.Release|x86.Build.0 = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x64.ActiveCfg = Debug|x64
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x64.Build.0 = Debug|x64
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x86.ActiveCfg = Debug|x86
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x86.Build.0 = Debug|x86
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x64.ActiveCfg = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x64.Build.0 = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x86.ActiveCfg = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Debug|x86.Build.0 = Debug|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|Any CPU.Build.0 = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x64.ActiveCfg = Release|x64
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x64.Build.0 = Release|x64
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x86.ActiveCfg = Release|x86
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x86.Build.0 = Release|x86
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x64.ActiveCfg = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x64.Build.0 = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x86.ActiveCfg = Release|Any CPU
{60932B3D-F9A5-40FD-AD17-F3BF2540D67D}.Release|x86.Build.0 = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x64.ActiveCfg = Debug|x64
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x64.Build.0 = Debug|x64
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x86.ActiveCfg = Debug|x86
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x86.Build.0 = Debug|x86
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x64.ActiveCfg = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x64.Build.0 = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x86.ActiveCfg = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Debug|x86.Build.0 = Debug|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|Any CPU.Build.0 = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x64.ActiveCfg = Release|x64
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x64.Build.0 = Release|x64
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x86.ActiveCfg = Release|x86
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x86.Build.0 = Release|x86
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x64.ActiveCfg = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x64.Build.0 = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x86.ActiveCfg = Release|Any CPU
{22359A31-BC1E-4F75-860B-3A1773969F19}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D4C1D667-89AE-4C6A-BAAA-7DCF34A72516}
EndGlobalSection
EndGlobal
60 changes: 0 additions & 60 deletions src/s2client-fsharp/Async.fs

This file was deleted.

16 changes: 16 additions & 0 deletions src/s2client-fsharp/ErrorDefs.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Starcraft2

type ApplicationError =
|FailedToEstablishConnection of string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okish with railway style as long as we properly forward error information (or logging it for that matter) instead of throwing everything away and only keeping the "Message" here.

"Standard" Exception handling has lots of features you now basically need to replicate manually.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

|SendMessageBufferTooSmall
|ExpectedBinaryResponse
|FailedToSendMessage of string
|FailedToReceiveMessage of string
|NullResultWithNoError
|NullResultWithError of string seq
|ExecutableNotFound of string
|ConfigError of string
|GameNotStarted
|GameNotJoined
|NotInGame
|BotError
Loading